summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-08-03 23:00:31 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-08-03 23:00:31 +0000
commit533c33f0712eed5087ce0cfedbe02597d1fa9865 (patch)
treec988500555689ce57aebcbe060dee324cdb36460
parent2e4a59904baca38a6acef7fda1705caadf5f601d (diff)
parent85e62ac7b0eb3e79c6c6e4a7335a376c9bd9e9e0 (diff)
downloadcts-533c33f0712eed5087ce0cfedbe02597d1fa9865.tar.gz
Snap for 8903759 from 85e62ac7b0eb3e79c6c6e4a7335a376c9bd9e9e0 to tm-d1-release
Change-Id: I1980a05b4e3b400408afa0e04dfa980a9c4b7cf9
-rw-r--r--apps/CameraITS/tests/scene5/test_lens_shading_and_color_uniformity.py12
-rw-r--r--apps/CtsVerifier/AndroidManifest.xml213
-rw-r--r--apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java4
-rw-r--r--hostsidetests/securitybulletin/src/android/security/cts/Bug_182810085.java54
-rw-r--r--hostsidetests/securitybulletin/src/android/security/cts/CVE_2021_39795.java73
-rw-r--r--hostsidetests/securitybulletin/test-apps/BUG-182810085/Android.bp31
-rw-r--r--hostsidetests/securitybulletin/test-apps/BUG-182810085/AndroidManifest.xml48
-rw-r--r--hostsidetests/securitybulletin/test-apps/BUG-182810085/res/layout/activity_main.xml27
-rw-r--r--hostsidetests/securitybulletin/test-apps/BUG-182810085/res/values/strings.xml19
-rw-r--r--hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/Constants.java25
-rw-r--r--hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/DeviceTest.java122
-rw-r--r--hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/MainActivity.java85
-rw-r--r--hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/OverlayService.java95
-rw-r--r--hostsidetests/securitybulletin/test-apps/CVE-2021-39795/Android.bp36
-rw-r--r--hostsidetests/securitybulletin/test-apps/CVE-2021-39795/AndroidManifest.xml27
-rw-r--r--hostsidetests/securitybulletin/test-apps/CVE-2021-39795/res/values/strings.xml32
-rw-r--r--hostsidetests/securitybulletin/test-apps/CVE-2021-39795/src/android/security/cts/CVE_2021_39795/DeviceTest.java94
-rwxr-xr-xtests/framework/base/windowmanager/src/android/server/wm/KeyguardTests.java16
-rw-r--r--tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java2
-rw-r--r--tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerStateHelper.java4
-rw-r--r--tests/tests/hardware/AndroidManifest.xml10
-rw-r--r--tests/tests/hardware/res/raw/keyboard_layout_english_us.kcm311
-rw-r--r--tests/tests/hardware/res/raw/keyboard_layout_french.kcm336
-rw-r--r--tests/tests/hardware/res/raw/keyboard_layout_german.kcm333
-rw-r--r--tests/tests/hardware/res/xml/keyboard_layouts.xml31
-rw-r--r--tests/tests/hardware/src/android/hardware/input/cts/tests/KeyboardLayoutChangeTest.java12
-rw-r--r--tests/tests/media/codec/src/android/media/codec/cts/MediaCodecResourceTest.java8
27 files changed, 2054 insertions, 6 deletions
diff --git a/apps/CameraITS/tests/scene5/test_lens_shading_and_color_uniformity.py b/apps/CameraITS/tests/scene5/test_lens_shading_and_color_uniformity.py
index ae1f315c3e4..c1e50bd561a 100644
--- a/apps/CameraITS/tests/scene5/test_lens_shading_and_color_uniformity.py
+++ b/apps/CameraITS/tests/scene5/test_lens_shading_and_color_uniformity.py
@@ -146,6 +146,7 @@ class LensShadingAndColorUniformityTest(its_base_test.ItsBaseTest):
props = cam.get_camera_properties()
props = cam.override_with_hidden_physical_camera_props(props)
log_path = self.log_path
+ debug_mode = self.debug_mode
# Check SKIP conditions.
camera_properties_utils.skip_unless(
@@ -163,7 +164,16 @@ class LensShadingAndColorUniformityTest(its_base_test.ItsBaseTest):
req = capture_request_utils.auto_capture_request()
w, h = capture_request_utils.get_available_output_sizes('yuv', props)[0]
out_surface = {'format': 'yuv', 'width': w, 'height': h}
- cap = cam.do_capture(req, out_surface)
+ if debug_mode:
+ out_surfaces = [{'format': 'raw'}, out_surface]
+ cap_raw, cap = cam.do_capture(req, out_surfaces)
+ img_raw = image_processing_utils.convert_capture_to_rgb_image(
+ cap_raw, props=props)
+ image_processing_utils.write_image(img_raw, '%s_raw.png' % (
+ os.path.join(log_path, _NAME)), True)
+ logging.debug('Captured RAW %dx%d', img_raw.shape[1], img_raw.shape[0])
+ else:
+ cap = cam.do_capture(req, out_surface)
logging.debug('Captured YUV %dx%d', w, h)
# Get Y channel
img_y = image_processing_utils.convert_capture_to_planes(cap)[0]
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index fde8f7edbb7..effce908cfd 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -3537,6 +3537,14 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.WifiNetworkSpecifier.Builder#build
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setSsidPattern
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setBssidPattern
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setWpa2Passphrase
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setWpa2Passphrase
+ |android.net.NetworkRequest.Builder#setNetworkSpecifier
+ |android.net.ConnectivityManager#requestNetwork" />
</activity>
<activity android:name=".wifi.NetworkRequestPatternNetworkSpecifierTestActivity"
@@ -3544,6 +3552,14 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.WifiNetworkSpecifier.Builder#build
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setSsidPattern
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setBssidPattern
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setWpa2Passphrase
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setWpa2Passphrase
+ |android.net.NetworkRequest.Builder#setNetworkSpecifier
+ |android.net.ConnectivityManager#requestNetwork" />
</activity>
<activity android:name=".wifi.NetworkRequestUnavailableNetworkSpecifierTestActivity"
@@ -3551,6 +3567,14 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.WifiNetworkSpecifier.Builder#build
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setSsidPattern
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setBssidPattern
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setWpa2Passphrase
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setWpa2Passphrase
+ |android.net.NetworkRequest.Builder#setNetworkSpecifier
+ |android.net.ConnectivityManager#requestNetwork" />
</activity>
<activity android:name=".wifi.NetworkRequestInvalidCredentialNetworkSpecifierTestActivity"
@@ -3558,6 +3582,14 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.WifiNetworkSpecifier.Builder#build
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setSsid
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setBssid
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setWpa2Passphrase
+ |android.net.wifi.WifiNetworkSpecifier.Builder#setWpa2Passphrase
+ |android.net.NetworkRequest.Builder#setNetworkSpecifier
+ |android.net.ConnectivityManager#requestNetwork" />
</activity>
<activity android:name=".wifi.NetworkSuggestionSsidTestActivity"
@@ -3565,6 +3597,19 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.WifiNetworkSuggestion.Builder#build
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setSsid
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setBssid
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setWpa2Passphrase
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setWpa3Passphrase
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setIsMetered
+ |android.net.wifi.WifiManager#addNetworkSuggestions
+ |android.net.wifi.WifiManager#addSuggestionUserApprovalStatusListener
+ |android.net.wifi.WifiManager#getNetworkSuggestions
+ |android.net.wifi.WifiManager#removeNetworkSuggestions
+ |android.net.wifi.WifiManager#removeSuggestionConnectionStatusListener
+ |android.net.wifi.WifiManager#addSuggestionConnectionStatusListener" />
</activity>
<activity android:name=".wifi.NetworkSuggestionSsidBssidTestActivity"
@@ -3572,6 +3617,19 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.WifiNetworkSuggestion.Builder#build
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setSsid
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setBssid
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setWpa2Passphrase
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setWpa3Passphrase
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setIsMetered
+ |android.net.wifi.WifiManager#addNetworkSuggestions
+ |android.net.wifi.WifiManager#addSuggestionUserApprovalStatusListener
+ |android.net.wifi.WifiManager#getNetworkSuggestions
+ |android.net.wifi.WifiManager#removeNetworkSuggestions
+ |android.net.wifi.WifiManager#removeSuggestionConnectionStatusListener
+ |android.net.wifi.WifiManager#addSuggestionConnectionStatusListener" />
</activity>
<activity android:name=".wifi.NetworkSuggestionSsidPostConnectTestActivity"
@@ -3579,6 +3637,19 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.WifiNetworkSuggestion.Builder#build
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setSsid
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setBssid
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setWpa2Passphrase
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setWpa3Passphrase
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setIsMetered
+ |android.net.wifi.WifiManager#addNetworkSuggestions
+ |android.net.wifi.WifiManager#addSuggestionUserApprovalStatusListener
+ |android.net.wifi.WifiManager#getNetworkSuggestions
+ |android.net.wifi.WifiManager#removeNetworkSuggestions
+ |android.net.wifi.WifiManager#removeSuggestionConnectionStatusListener
+ |android.net.wifi.WifiManager#addSuggestionConnectionStatusListener" />
</activity>
<activity android:name=".wifi.NetworkSuggestionConnectionFailureTestActivity"
@@ -3586,6 +3657,19 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.WifiNetworkSuggestion.Builder#build
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setSsid
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setBssid
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setWpa2Passphrase
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setWpa3Passphrase
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setIsMetered
+ |android.net.wifi.WifiManager#addNetworkSuggestions
+ |android.net.wifi.WifiManager#addSuggestionUserApprovalStatusListener
+ |android.net.wifi.WifiManager#getNetworkSuggestions
+ |android.net.wifi.WifiManager#removeNetworkSuggestions
+ |android.net.wifi.WifiManager#removeSuggestionConnectionStatusListener
+ |android.net.wifi.WifiManager#addSuggestionConnectionStatusListener" />
</activity>
<activity android:name=".wifi.NetworkSuggestionModificationInPlaceTestActivity"
@@ -3593,6 +3677,19 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.WifiNetworkSuggestion.Builder#build
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setSsid
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setBssid
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setWpa2Passphrase
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setWpa3Passphrase
+ |android.net.wifi.WifiNetworkSuggestion.Builder#setIsMetered
+ |android.net.wifi.WifiManager#addNetworkSuggestions
+ |android.net.wifi.WifiManager#addSuggestionUserApprovalStatusListener
+ |android.net.wifi.WifiManager#getNetworkSuggestions
+ |android.net.wifi.WifiManager#removeNetworkSuggestions
+ |android.net.wifi.WifiManager#removeSuggestionConnectionStatusListener
+ |android.net.wifi.WifiManager#addSuggestionConnectionStatusListener" />
</activity>
<activity android:name=".p2p.GoNegRequesterTestListActivity"
@@ -3756,6 +3853,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.PublishConfig.Builder#setPublishType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathOpenPassiveSubscribeTestActivity"
@@ -3763,6 +3863,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathOpenPassiveSubscribeAcceptAnyTestActivity"
@@ -3770,6 +3873,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPassphraseUnsolicitedPublishTestActivity"
@@ -3777,6 +3884,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.PublishConfig.Builder#setPublishType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPassphrasePassiveSubscribeTestActivity"
@@ -3784,6 +3894,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPskPassphrase
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPassphrasePassiveSubscribeAcceptAnyTestActivity"
@@ -3791,6 +3905,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPskPassphrase
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPmkUnsolicitedPublishTestActivity"
@@ -3798,6 +3916,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.PublishConfig.Builder#setPublishType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPmk
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPmkPassiveSubscribeTestActivity"
@@ -3805,6 +3927,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPmk
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPmkPassiveSubscribeAcceptAnyTestActivity"
@@ -3812,6 +3938,11 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPmk
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder" />
</activity>
<activity android:name=".wifiaware.DataPathOpenSolicitedPublishTestActivity"
@@ -3819,6 +3950,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.PublishConfig.Builder#setPublishType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathOpenActiveSubscribeTestActivity"
@@ -3826,6 +3960,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathOpenActiveSubscribeAcceptAnyTestActivity"
@@ -3833,6 +3970,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPassphraseSolicitedPublishTestActivity"
@@ -3840,6 +3981,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.PublishConfig.Builder#setPublishType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPassphrase
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPassphraseActiveSubscribeTestActivity"
@@ -3847,6 +3992,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPskPassphrase
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPassphraseActiveSubscribeAcceptAnyTestActivity"
@@ -3854,6 +4003,11 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPskPassphrase
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPmkSolicitedPublishTestActivity"
@@ -3861,6 +4015,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.PublishConfig.Builder#setPublishType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPmk
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPmkActiveSubscribeTestActivity"
@@ -3868,6 +4026,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPmk
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build" />
</activity>
<activity android:name=".wifiaware.DataPathPmkActiveSubscribeAcceptAnyTestActivity"
@@ -3875,6 +4037,11 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.SubscribeConfig.Builder#setSubscribeType
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPmk
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder" />
</activity>
<activity android:name=".wifiaware.DataPathOobOpenResponderTestActivity"
@@ -3882,6 +4049,8 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareSession#createNetworkSpecifierOpen" />
</activity>
<activity android:name=".wifiaware.DataPathOobOpenInitiatorTestActivity"
@@ -3889,6 +4058,8 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareSession#createNetworkSpecifierOpen" />
</activity>
<activity android:name=".wifiaware.DataPathOobPassphraseResponderTestActivity"
@@ -3896,6 +4067,8 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareSession#createNetworkSpecifierPassphrase" />
</activity>
<activity android:name=".wifiaware.DataPathOobPassphraseInitiatorTestActivity"
@@ -3903,6 +4076,8 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareSession#createNetworkSpecifierPassphrase" />
</activity>
<activity android:name=".wifiaware.DiscoveryRangingPublishTestActivity"
@@ -3910,6 +4085,12 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.rtt.RangingRequest.Builder#addWifiAwarePeer
+ |android.net.wifi.aware.PublishConfig.Builder#setRangingEnabled
+ |android.net.wifi.rtt.WifiRttManager#startRanging
+ |android.net.wifi.aware.WifiAwareManager#attach
+ |android.net.wifi.aware.WifiAwareSession#publish" />
</activity>
<activity android:name=".wifiaware.DiscoveryRangingSubscribeTestActivity"
@@ -3917,6 +4098,12 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.rtt.RangingRequest.Builder#addWifiAwarePeer
+ |android.net.wifi.aware.SubscribeConfig.Builder#setMaxDistanceMm
+ |android.net.wifi.rtt.WifiRttManager#startRanging
+ |android.net.wifi.aware.WifiAwareManager#attach
+ |android.net.wifi.aware.WifiAwareSession#subscrible" />
</activity>
<activity android:name=".wifiaware.DataPathOpenSolicitedPublishAcceptAnyTestActivity"
@@ -3924,6 +4111,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build
+ |android.net.NetworkCapabilities#TRANSPORT_WIFI_AWARE" />
</activity>
<activity android:name=".wifiaware.DataPathPmkUnsolicitedPublishAcceptAnyTestActivity"
@@ -3931,6 +4122,10 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#build
+ |android.net.NetworkCapabilities#TRANSPORT_WIFI_AWARE" />
</activity>
<activity android:name=".wifiaware.DataPathPmkSolicitedPublishAcceptAnyTestActivity"
@@ -3938,6 +4133,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPmk" />
</activity>
<activity android:name=".wifiaware.DataPathPassphraseUnsolicitedPublishAcceptAnyTestActivity"
@@ -3945,6 +4143,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPskPassphrase" />
</activity>
<activity android:name=".wifiaware.DataPathPassphraseSolicitedPublishAcceptAnyTestActivity"
@@ -3952,6 +4153,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPskPassphrase" />
</activity>
<activity android:name=".wifiaware.DataPathOpenUnsolicitedPublishAcceptAnyTestActivity"
@@ -3959,6 +4163,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setPskPassphrase" />
</activity>
<activity android:name=".wifiaware.DataPathForceChannelSetupSubscribeTestActivity"
@@ -3966,6 +4173,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setChannelFrequencyMhz" />
</activity>
<activity android:name=".wifiaware.DataPathForceChannelSetupPublishTestActivity"
@@ -3973,6 +4183,9 @@
android:configChanges="keyboardHidden|orientation|screenSize" >
<meta-data android:name="display_mode"
android:value="single_display_mode" />
+ <meta-data android:name="ApiTest"
+ android:value="android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#Builder
+ |android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder#setChannelFrequencyMhz" />
</activity>
<activity-alias
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 212f988d205..106bd0b2ab6 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
@@ -1036,7 +1036,9 @@ public class ItsService extends Service implements SensorEventListener {
@Override
public void onImageAvailable(ImageReader reader) {
Image i = reader.acquireNextImage();
- i.close();
+ if (i != null) {
+ i.close();
+ }
}
};
}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Bug_182810085.java b/hostsidetests/securitybulletin/src/android/security/cts/Bug_182810085.java
new file mode 100644
index 00000000000..1f5caa52834
--- /dev/null
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Bug_182810085.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 android.security.cts;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import android.platform.test.annotations.AsbSecurityTest;
+
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import com.android.sts.common.tradefed.testtype.StsExtraBusinessLogicHostTestBase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class Bug_182810085 extends StsExtraBusinessLogicHostTestBase {
+ private static final String TEST_PKG = "android.security.cts.BUG_182810085";
+ private static final String TEST_CLASS = TEST_PKG + "." + "DeviceTest";
+ private static final String TEST_APP = "BUG-182810085.apk";
+
+ @Before
+ public void setUp() throws Exception {
+ assumeTrue(
+ "not an Automotive device",
+ getDevice().hasFeature("feature:android.hardware.type.automotive"));
+ uninstallPackage(getDevice(), TEST_PKG);
+ }
+
+ @Test
+ @AsbSecurityTest(cveBugId = 182810085)
+ public void testRunDeviceTestsPassesFull() throws Exception {
+ installPackage(TEST_APP);
+ // Grant permission to draw overlays.
+ getDevice().executeShellCommand(
+ "pm grant " + TEST_PKG + " android.permission.SYSTEM_ALERT_WINDOW");
+ assertTrue(runDeviceTests(TEST_PKG, TEST_CLASS, "testTapjacking"));
+ }
+}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/CVE_2021_39795.java b/hostsidetests/securitybulletin/src/android/security/cts/CVE_2021_39795.java
new file mode 100644
index 00000000000..4755ddbb229
--- /dev/null
+++ b/hostsidetests/securitybulletin/src/android/security/cts/CVE_2021_39795.java
@@ -0,0 +1,73 @@
+/*
+ * 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.StsExtraBusinessLogicHostTestBase;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class CVE_2021_39795 extends StsExtraBusinessLogicHostTestBase {
+ private static final String TEST_PKG = "android.security.cts.CVE_2021_39795";
+ private static final String DIR_PATH = "/storage/emulated/0/Android/data/CVE-2021-39795-dir";
+
+ @AsbSecurityTest(cveBugId = 201667614)
+ @Test
+ public void testPocCVE_2021_39795() {
+ ITestDevice device = null;
+ try {
+ device = getDevice();
+
+ /* Wake up the screen */
+ AdbUtils.runCommandLine("input keyevent KEYCODE_WAKEUP", device);
+ AdbUtils.runCommandLine("input keyevent KEYCODE_MENU", device);
+ AdbUtils.runCommandLine("input keyevent KEYCODE_HOME", device);
+
+ installPackage("CVE-2021-39795.apk");
+
+ /* Make a directory inside "Android/data" folder */
+ AdbUtils.runCommandLine("mkdir " + DIR_PATH, device);
+
+ /* Allow Read and Write to external storage */
+ AdbUtils.runCommandLine(
+ "pm grant " + TEST_PKG + " android.permission.READ_EXTERNAL_STORAGE", device);
+ AdbUtils.runCommandLine(
+ "pm grant " + TEST_PKG + " android.permission.WRITE_EXTERNAL_STORAGE", device);
+
+ /* Allow the app to manage all files */
+ AdbUtils.runCommandLine(
+ "appops set --uid " + TEST_PKG + " MANAGE_EXTERNAL_STORAGE allow", device);
+
+ runDeviceTests(TEST_PKG, TEST_PKG + ".DeviceTest", "testFilePresence");
+ } catch (Exception e) {
+ assumeNoException(e);
+ } finally {
+ try {
+ AdbUtils.runCommandLine("rm -rf " + DIR_PATH, device);
+ } catch (Exception e) {
+ // ignore the exceptions
+ }
+ }
+ }
+}
diff --git a/hostsidetests/securitybulletin/test-apps/BUG-182810085/Android.bp b/hostsidetests/securitybulletin/test-apps/BUG-182810085/Android.bp
new file mode 100644
index 00000000000..d7af1caff97
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/BUG-182810085/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "BUG-182810085",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ test_suites: [
+ "cts",
+ "vts10",
+ "sts",
+ ],
+ static_libs: [
+ "androidx.appcompat_appcompat",
+ "androidx.test.rules",
+ "androidx.test.uiautomator_uiautomator",
+ "androidx.test.core",
+ ],
+ sdk_version: "current",
+}
diff --git a/hostsidetests/securitybulletin/test-apps/BUG-182810085/AndroidManifest.xml b/hostsidetests/securitybulletin/test-apps/BUG-182810085/AndroidManifest.xml
new file mode 100644
index 00000000000..5777c1825ac
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/BUG-182810085/AndroidManifest.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.security.cts.BUG_182810085"
+ minSdkVersion="29">
+
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+
+ <application android:theme="@style/Theme.AppCompat.Light">
+ <uses-library android:name="android.test.runner" />
+ <service android:name=".OverlayService"
+ android:enabled="true"
+ android:exported="false" />
+
+ <activity
+ android:name=".MainActivity"
+ android:label="ST (Permission)"
+ android:exported="true"
+ android:taskAffinity="android.security.cts.BUG_182810085.MainActivity">
+
+ <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"
+ android:targetPackage="android.security.cts.BUG_182810085" />
+
+</manifest>
diff --git a/hostsidetests/securitybulletin/test-apps/BUG-182810085/res/layout/activity_main.xml b/hostsidetests/securitybulletin/test-apps/BUG-182810085/res/layout/activity_main.xml
new file mode 100644
index 00000000000..0ac0cf489f4
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/BUG-182810085/res/layout/activity_main.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="left"
+ tools:context=".MainActivity" >
+
+ <LinearLayout
+ android:id="@+id/linearLayout1"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/seekShowTimes"
+ android:layout_centerHorizontal="true"
+ android:layout_marginTop="53dp"
+ android:orientation="horizontal" >
+
+ <Button
+ android:id="@+id/btnStart"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Start" />
+
+ </LinearLayout>
+
+</RelativeLayout>
diff --git a/hostsidetests/securitybulletin/test-apps/BUG-182810085/res/values/strings.xml b/hostsidetests/securitybulletin/test-apps/BUG-182810085/res/values/strings.xml
new file mode 100644
index 00000000000..347c9e1dec7
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/BUG-182810085/res/values/strings.xml
@@ -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.
+ -->
+
+<resources>
+ <string name="tapjacking_text">BUG_182810085 overlay text</string>
+</resources>
diff --git a/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/Constants.java b/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/Constants.java
new file mode 100644
index 00000000000..d7b940e99eb
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/Constants.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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.BUG_182810085;
+
+final class Constants {
+
+ public static final String LOG_TAG = "BUG-182810085";
+ public static final String TEST_APP_PACKAGE = Constants.class.getPackage().getName();
+
+ public static final String ACTION_START_TAPJACKING = "BUG_182810085.start_tapjacking";
+}
diff --git a/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/DeviceTest.java b/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/DeviceTest.java
new file mode 100644
index 00000000000..4dbe976cdb0
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/DeviceTest.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 android.security.cts.BUG_182810085;
+
+import static android.security.cts.BUG_182810085.Constants.LOG_TAG;
+
+import org.junit.Before;
+import org.junit.After;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.util.Log;
+
+import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+
+import androidx.test.runner.AndroidJUnit4;
+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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+
+/** Basic sample for unbundled UiAutomator. */
+@RunWith(AndroidJUnit4.class)
+public class DeviceTest {
+
+ private static final long WAIT_FOR_UI_TIMEOUT = 20_000;
+
+ private Context mContext;
+ private UiDevice mDevice;
+
+ @Before
+ public void setUp() throws Exception {
+ Log.d(LOG_TAG, "startMainActivityFromHomeScreen()");
+
+ mContext = getApplicationContext();
+
+ // If the permission is not granted, the app will not be able to show an overlay dialog.
+ // This is required for the test below.
+ // NOTE: The permission is granted by the HostJUnit4Test implementation and should not fail.
+ assertEquals("Permission SYSTEM_ALERT_WINDOW not granted!",
+ mContext.checkSelfPermission("android.permission.SYSTEM_ALERT_WINDOW"),
+ PackageManager.PERMISSION_GRANTED);
+
+ // Initialize UiDevice instance
+ mDevice = UiDevice.getInstance(getInstrumentation());
+ if (!mDevice.isScreenOn()) {
+ mDevice.wakeUp();
+ }
+ mDevice.pressHome();
+ }
+
+ @Test
+ public void testTapjacking() throws InterruptedException {
+ Log.d(LOG_TAG, "Starting tap-jacking test");
+
+ launchTestApp();
+
+ launchTapjackedActivity();
+
+ mContext.sendBroadcast(new Intent(Constants.ACTION_START_TAPJACKING));
+ Log.d(LOG_TAG, "Sent intent to start tap-jacking!");
+
+ UiObject2 overlay = waitForView(By.text(mContext.getString(R.string.tapjacking_text)));
+ assertNull("Tap-jacking successful. Overlay was displayed.!", overlay);
+ }
+
+ @After
+ public void tearDown() {
+ mDevice.pressHome();
+ }
+
+ private void launchTestApp() {
+ Intent intent = mContext.getPackageManager().getLaunchIntentForPackage(
+ Constants.TEST_APP_PACKAGE);
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ mContext.startActivity(intent);
+
+ // Wait for the app to appear
+ UiObject2 view = waitForView(By.pkg(Constants.TEST_APP_PACKAGE).depth(0));
+ assertNotNull("test-app did not appear!", view);
+ Log.d(LOG_TAG, "test-app appeared");
+ }
+
+ private void launchTapjackedActivity() {
+ Intent intent = new Intent();
+ intent.setAction("android.settings.BLUETOOTH_SETTINGS");
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
+ mContext.startActivity(intent);
+
+ UiObject2 activityInstance = waitForView(By.pkg("com.android.car.settings").depth(0));
+ assertNotNull("Activity under-test was not launched or found!", activityInstance);
+
+ Log.d(LOG_TAG, "Started Activity under-test.");
+ }
+
+ private UiObject2 waitForView(BySelector selector) {
+ return mDevice.wait(Until.findObject(selector), WAIT_FOR_UI_TIMEOUT);
+ }
+}
diff --git a/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/MainActivity.java b/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/MainActivity.java
new file mode 100644
index 00000000000..b31e83bddcb
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/MainActivity.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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.BUG_182810085;
+
+import static android.security.cts.BUG_182810085.Constants.LOG_TAG;
+
+import android.app.AlertDialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.WindowManager.LayoutParams;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.SeekBar;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+import java.util.ArrayList;
+
+/** Main activity for the test-app. */
+public final class MainActivity extends AppCompatActivity {
+
+ private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ public void onReceive(Context context, Intent intent) {
+ startTapjacking();
+ }
+ };
+
+ private Button btnStart;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ registerReceiver(mReceiver, new IntentFilter(Constants.ACTION_START_TAPJACKING));
+
+ btnStart = (Button) findViewById(R.id.btnStart);
+ btnStart.setOnClickListener(v -> startTapjacking());
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ unregisterReceiver(mReceiver);
+ stopOverlayService();
+ }
+
+ public void startTapjacking() {
+ Log.d(LOG_TAG, "Starting tap-jacking flow.");
+ stopOverlayService();
+
+ startOverlayService();
+ Log.d(LOG_TAG, "Started overlay-service.");
+ }
+
+ private void startOverlayService() {
+ startService(new Intent(getApplicationContext(), OverlayService.class));
+ }
+
+ private void stopOverlayService() {
+ stopService(new Intent(getApplicationContext(), OverlayService.class));
+ }
+}
diff --git a/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/OverlayService.java b/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/OverlayService.java
new file mode 100644
index 00000000000..0c62a80ca46
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/BUG-182810085/src/android/security/cts/BUG_182810085/OverlayService.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 android.security.cts.BUG_182810085;
+
+import android.app.Service;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.graphics.PixelFormat;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Looper;
+import android.provider.Settings;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.WindowManager;
+import android.widget.Button;
+
+/** Service that starts the overlay for the test. */
+public final class OverlayService extends Service {
+ public Button mButton;
+ private WindowManager mWindowManager;
+ private WindowManager.LayoutParams mLayoutParams;
+
+ @Override
+ public void onCreate() {
+ Log.d(Constants.LOG_TAG, "onCreate() called");
+ super.onCreate();
+
+ DisplayMetrics displayMetrics = Resources.getSystem().getDisplayMetrics();
+ int scaledWidth = (int) (displayMetrics.widthPixels * 0.9);
+ int scaledHeight = (int) (displayMetrics.heightPixels * 0.9);
+
+ mWindowManager = getSystemService(WindowManager.class);
+ mLayoutParams = new WindowManager.LayoutParams();
+ mLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+ mLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
+ | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+ mLayoutParams.format = PixelFormat.OPAQUE;
+ mLayoutParams.gravity = Gravity.CENTER;
+ mLayoutParams.width = scaledWidth;
+ mLayoutParams.height = scaledHeight;
+ mLayoutParams.x = scaledWidth / 2;
+ mLayoutParams.y = scaledHeight / 2;
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ Log.d(Constants.LOG_TAG, "onStartCommand() called");
+ showFloatingWindow();
+ return super.onStartCommand(intent, flags, startId);
+ }
+
+ @Override
+ public void onDestroy() {
+ Log.d(Constants.LOG_TAG, "onDestroy() called");
+ if (mWindowManager != null && mButton != null) {
+ mWindowManager.removeView(mButton);
+ }
+ super.onDestroy();
+ }
+
+ private void showFloatingWindow() {
+ if (!Settings.canDrawOverlays(this)) {
+ Log.w(Constants.LOG_TAG, "Cannot show overlay window. Permission denied");
+ }
+
+ mButton = new Button(getApplicationContext());
+ mButton.setText(getResources().getString(R.string.tapjacking_text));
+ mButton.setTag(mButton.getVisibility());
+ mWindowManager.addView(mButton, mLayoutParams);
+
+ new Handler(Looper.myLooper()).postDelayed(this::stopSelf, 60_000);
+ Log.d(Constants.LOG_TAG, "Floating window created");
+ }
+}
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/Android.bp
new file mode 100644
index 00000000000..ade2215f2d7
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/Android.bp
@@ -0,0 +1,36 @@
+/*
+ * 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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_test_helper_app {
+ name: "CVE-2021-39795",
+ defaults: [
+ "cts_support_defaults"
+ ],
+ srcs: [
+ "src/**/*.java",
+ ],
+ test_suites: [
+ "sts",
+ ],
+ static_libs: [
+ "androidx.test.rules",
+ "androidx.test.core",
+ ],
+}
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/AndroidManifest.xml b/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/AndroidManifest.xml
new file mode 100644
index 00000000000..cb42aedc255
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<?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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.security.cts.CVE_2021_39795">
+ <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.security.cts.CVE_2021_39795" />
+</manifest>
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/res/values/strings.xml b/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/res/values/strings.xml
new file mode 100644
index 00000000000..19ea461d4cb
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/res/values/strings.xml
@@ -0,0 +1,32 @@
+<?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="filePath">Android/data/CVE-2021-39795-dir/</string>
+ <string name="fileContent">Bypassed by MediaProvider</string>
+ <string name="fileName">CVE-2021-39795-file</string>
+ <string name="external">external</string>
+ <string name="secondFixFailure">Second Fix Patch not applied.
+ Please Apply second Fix Patch!!</string>
+ <string name="fileUtilPkg">com.android.providers.media.util.FileUtils</string>
+ <string name="isDataOrObbPathMethod">isDataOrObbPath</string>
+ <string name="mediaProviderPkg">com.android.providers.media.module</string>
+ <string name="sampleFilePath">/storage/emulated/0/Android/data/foo</string>
+ <string name="failure">Device vulnerable to b/201667614! Any app with
+ MANAGE_EXTERNAL_STORAGE permission can write into other apps private
+ external directory.</string>
+</resources>
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/src/android/security/cts/CVE_2021_39795/DeviceTest.java b/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/src/android/security/cts/CVE_2021_39795/DeviceTest.java
new file mode 100644
index 00000000000..8d3ff0a9602
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-39795/src/android/security/cts/CVE_2021_39795/DeviceTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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_2021_39795;
+
+import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeNoException;
+
+import android.content.Context;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.res.Resources;
+import android.provider.MediaStore;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.OutputStream;
+import java.lang.reflect.Method;
+
+@RunWith(AndroidJUnit4.class)
+public class DeviceTest {
+
+ @Test
+ public void testFilePresence() {
+ boolean isSecondPatchAbsent = false;
+ Resources resources = null;
+ OutputStream outputStream = null;
+ try {
+ // Accessing FileUtils.isDataOrObbPath() to detect the presence of second patch of fix.
+ Context context = getApplicationContext();
+ resources = context.getResources();
+ Context mediaProviderContext =
+ context.createPackageContext(resources.getString(R.string.mediaProviderPkg),
+ Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
+ ClassLoader fileUtilsClassLoader = mediaProviderContext.getClassLoader();
+ Class<?> FileUtilsClass =
+ fileUtilsClassLoader.loadClass(resources.getString(R.string.fileUtilPkg));
+ Method isDataOrObbPathMethod = FileUtilsClass.getDeclaredMethod(
+ resources.getString(R.string.isDataOrObbPathMethod), String.class);
+ isDataOrObbPathMethod.setAccessible(true);
+ isSecondPatchAbsent = (boolean) isDataOrObbPathMethod.invoke(this,
+ resources.getString(R.string.sampleFilePath));
+
+ // Checking write into external directory.
+ ContentValues values = new ContentValues();
+ ContentResolver contentResolver = context.getContentResolver();
+ values.put(MediaStore.MediaColumns.RELATIVE_PATH,
+ resources.getString(R.string.filePath));
+ values.put(MediaStore.MediaColumns.DISPLAY_NAME,
+ resources.getString(R.string.fileName));
+ outputStream = contentResolver.openOutputStream(contentResolver.insert(
+ MediaStore.Files.getContentUri(resources.getString(R.string.external)),
+ values));
+ outputStream.write(resources.getString(R.string.fileContent).getBytes());
+
+ /*
+ * If control flow has reached till this point it means no exception anywhere and fix is
+ * not present and it is vulnerable to the bug.
+ */
+ fail(resources.getString(R.string.failure));
+ } catch (IllegalArgumentException e) {
+ // First fix patch is applied, ignore this exception.
+ if (isSecondPatchAbsent) {
+ // Fail the test as Latest Fix Patch is not applied
+ fail(resources.getString(R.string.secondFixFailure));
+ }
+ } catch (Exception e) {
+ assumeNoException(e);
+ } finally {
+ try {
+ outputStream.close();
+ } catch (Exception e) {
+ // ignore all exceptions
+ }
+ }
+ }
+}
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTests.java b/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTests.java
index 306298042b9..e1b5d990a7a 100755
--- a/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTests.java
@@ -33,6 +33,7 @@ import static android.server.wm.app.Components.SHOW_WHEN_LOCKED_ACTIVITY;
import static android.server.wm.app.Components.SHOW_WHEN_LOCKED_ATTR_ACTIVITY;
import static android.server.wm.app.Components.SHOW_WHEN_LOCKED_ATTR_ROTATION_ACTIVITY;
import static android.server.wm.app.Components.SHOW_WHEN_LOCKED_DIALOG_ACTIVITY;
+import static android.server.wm.app.Components.SHOW_WHEN_LOCKED_NO_PREVIEW_ACTIVITY;
import static android.server.wm.app.Components.SHOW_WHEN_LOCKED_TRANSLUCENT_ACTIVITY;
import static android.server.wm.app.Components.SHOW_WHEN_LOCKED_WITH_DIALOG_ACTIVITY;
import static android.server.wm.app.Components.TEST_ACTIVITY;
@@ -480,6 +481,7 @@ public class KeyguardTests extends KeyguardTestBase {
assertTrue(mWmState.getKeyguardControllerState().keyguardShowing);
assertFalse(isDisplayOn(DEFAULT_DISPLAY));
}
+
/**
* Tests whether a FLAG_DISMISS_KEYGUARD activity occludes Keyguard.
*/
@@ -555,6 +557,20 @@ public class KeyguardTests extends KeyguardTestBase {
}
@Test
+ public void testDismissKeyguard_fromActivityOption_onlyOnce() {
+ // TODO(b/228431314): Move this test from CTS to flicker test.
+ final LockScreenSession lockScreenSession = createManagedLockScreenSession();
+
+ lockScreenSession.gotoKeyguard();
+ launchActivityWithDismissKeyguard(SHOW_WHEN_LOCKED_NO_PREVIEW_ACTIVITY);
+ mWmState.computeState(SHOW_WHEN_LOCKED_NO_PREVIEW_ACTIVITY);
+ mWmState.assertVisibility(SHOW_WHEN_LOCKED_NO_PREVIEW_ACTIVITY, true);
+
+ lockScreenSession.gotoKeyguard();
+ assertFalse(mWmState.getKeyguardControllerState().mKeyguardGoingAway);
+ }
+
+ @Test
public void testKeyguardLock() {
final LockScreenSession lockScreenSession = createManagedLockScreenSession();
lockScreenSession.gotoKeyguard();
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 adf308da06f..db8cec6ad63 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
@@ -1784,12 +1784,14 @@ public class WindowManagerState {
boolean aodShowing = false;
boolean keyguardShowing = false;
+ boolean mKeyguardGoingAway = false;
SparseArray<Boolean> mKeyguardOccludedStates = new SparseArray<>();
KeyguardControllerState(KeyguardControllerProto proto) {
if (proto != null) {
aodShowing = proto.aodShowing;
keyguardShowing = proto.keyguardShowing;
+ mKeyguardGoingAway = proto.keyguardGoingAway;
for (int i = 0; i < proto.keyguardPerDisplay.length; i++) {
mKeyguardOccludedStates.append(proto.keyguardPerDisplay[i].displayId,
proto.keyguardPerDisplay[i].keyguardOccluded);
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 a203a8457bd..661479ae5e9 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
@@ -698,6 +698,8 @@ public class WindowManagerStateHelper extends WindowManagerState {
public void assertKeyguardShowingAndOccluded() {
assertTrue("Keyguard is showing",
getKeyguardControllerState().keyguardShowing);
+ assertFalse("keygaurd is not going away",
+ getKeyguardControllerState().mKeyguardGoingAway);
assertTrue("Keyguard is occluded",
getKeyguardControllerState().isKeyguardOccluded(DEFAULT_DISPLAY));
}
@@ -705,6 +707,8 @@ public class WindowManagerStateHelper extends WindowManagerState {
public void assertKeyguardShowingAndNotOccluded() {
assertTrue("Keyguard is showing",
getKeyguardControllerState().keyguardShowing);
+ assertFalse("keygaurd is not going away",
+ getKeyguardControllerState().mKeyguardGoingAway);
assertFalse("Keyguard is not occluded",
getKeyguardControllerState().isKeyguardOccluded(DEFAULT_DISPLAY));
}
diff --git a/tests/tests/hardware/AndroidManifest.xml b/tests/tests/hardware/AndroidManifest.xml
index 6ac6d52dd8f..897e3df9d8e 100644
--- a/tests/tests/hardware/AndroidManifest.xml
+++ b/tests/tests/hardware/AndroidManifest.xml
@@ -103,6 +103,16 @@
android:label="FingerprintTestActivity">
</activity>
+ <receiver android:name="android.hardware.input.cts.tests.KeyboardLayoutChangeTest.CtsKeyboardLayoutProvider"
+ android:label="CTS keyboard layout provider"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS" />
+ </intent-filter>
+ <meta-data android:name="android.hardware.input.metadata.KEYBOARD_LAYOUTS"
+ android:resource="@xml/keyboard_layouts" />
+ </receiver>
+
</application>
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
diff --git a/tests/tests/hardware/res/raw/keyboard_layout_english_us.kcm b/tests/tests/hardware/res/raw/keyboard_layout_english_us.kcm
new file mode 100644
index 00000000000..ca9040259d1
--- /dev/null
+++ b/tests/tests/hardware/res/raw/keyboard_layout_english_us.kcm
@@ -0,0 +1,311 @@
+# 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.
+
+#
+# English (US) keyboard layout.
+# Unlike the default (generic) keyboard layout, English (US) does not contain any
+# special ALT characters.
+#
+
+type OVERLAY
+
+### ROW 1
+
+key GRAVE {
+ label: '`'
+ base: '`'
+ shift: '~'
+}
+
+key 1 {
+ label: '1'
+ base: '1'
+ shift: '!'
+}
+
+key 2 {
+ label: '2'
+ base: '2'
+ shift: '@'
+}
+
+key 3 {
+ label: '3'
+ base: '3'
+ shift: '#'
+}
+
+key 4 {
+ label: '4'
+ base: '4'
+ shift: '$'
+}
+
+key 5 {
+ label: '5'
+ base: '5'
+ shift: '%'
+}
+
+key 6 {
+ label: '6'
+ base: '6'
+ shift: '^'
+}
+
+key 7 {
+ label: '7'
+ base: '7'
+ shift: '&'
+}
+
+key 8 {
+ label: '8'
+ base: '8'
+ shift: '*'
+}
+
+key 9 {
+ label: '9'
+ base: '9'
+ shift: '('
+}
+
+key 0 {
+ label: '0'
+ base: '0'
+ shift: ')'
+}
+
+key MINUS {
+ label: '-'
+ base: '-'
+ shift: '_'
+}
+
+key EQUALS {
+ label: '='
+ base: '='
+ shift: '+'
+}
+
+### ROW 2
+
+key Q {
+ label: 'Q'
+ base: 'q'
+ shift, capslock: 'Q'
+}
+
+key W {
+ label: 'W'
+ base: 'w'
+ shift, capslock: 'W'
+}
+
+key E {
+ label: 'E'
+ base: 'e'
+ shift, capslock: 'E'
+}
+
+key R {
+ label: 'R'
+ base: 'r'
+ shift, capslock: 'R'
+}
+
+key T {
+ label: 'T'
+ base: 't'
+ shift, capslock: 'T'
+}
+
+key Y {
+ label: 'Y'
+ base: 'y'
+ shift, capslock: 'Y'
+}
+
+key U {
+ label: 'U'
+ base: 'u'
+ shift, capslock: 'U'
+}
+
+key I {
+ label: 'I'
+ base: 'i'
+ shift, capslock: 'I'
+}
+
+key O {
+ label: 'O'
+ base: 'o'
+ shift, capslock: 'O'
+}
+
+key P {
+ label: 'P'
+ base: 'p'
+ shift, capslock: 'P'
+}
+
+key LEFT_BRACKET {
+ label: '['
+ base: '['
+ shift: '{'
+}
+
+key RIGHT_BRACKET {
+ label: ']'
+ base: ']'
+ shift: '}'
+}
+
+key BACKSLASH {
+ label: '\\'
+ base: '\\'
+ shift: '|'
+}
+
+### ROW 3
+
+key A {
+ label: 'A'
+ base: 'a'
+ shift, capslock: 'A'
+}
+
+key S {
+ label: 'S'
+ base: 's'
+ shift, capslock: 'S'
+}
+
+key D {
+ label: 'D'
+ base: 'd'
+ shift, capslock: 'D'
+}
+
+key F {
+ label: 'F'
+ base: 'f'
+ shift, capslock: 'F'
+}
+
+key G {
+ label: 'G'
+ base: 'g'
+ shift, capslock: 'G'
+}
+
+key H {
+ label: 'H'
+ base: 'h'
+ shift, capslock: 'H'
+}
+
+key J {
+ label: 'J'
+ base: 'j'
+ shift, capslock: 'J'
+}
+
+key K {
+ label: 'K'
+ base: 'k'
+ shift, capslock: 'K'
+}
+
+key L {
+ label: 'L'
+ base: 'l'
+ shift, capslock: 'L'
+}
+
+key SEMICOLON {
+ label: ';'
+ base: ';'
+ shift: ':'
+}
+
+key APOSTROPHE {
+ label: '\''
+ base: '\''
+ shift: '"'
+}
+
+### ROW 4
+
+key Z {
+ label: 'Z'
+ base: 'z'
+ shift, capslock: 'Z'
+}
+
+key X {
+ label: 'X'
+ base: 'x'
+ shift, capslock: 'X'
+}
+
+key C {
+ label: 'C'
+ base: 'c'
+ shift, capslock: 'C'
+}
+
+key V {
+ label: 'V'
+ base: 'v'
+ shift, capslock: 'V'
+}
+
+key B {
+ label: 'B'
+ base: 'b'
+ shift, capslock: 'B'
+}
+
+key N {
+ label: 'N'
+ base: 'n'
+ shift, capslock: 'N'
+}
+
+key M {
+ label: 'M'
+ base: 'm'
+ shift, capslock: 'M'
+}
+
+key COMMA {
+ label: ','
+ base: ','
+ shift: '<'
+}
+
+key PERIOD {
+ label: '.'
+ base: '.'
+ shift: '>'
+}
+
+key SLASH {
+ label: '/'
+ base: '/'
+ shift: '?'
+}
diff --git a/tests/tests/hardware/res/raw/keyboard_layout_french.kcm b/tests/tests/hardware/res/raw/keyboard_layout_french.kcm
new file mode 100644
index 00000000000..65bcd132928
--- /dev/null
+++ b/tests/tests/hardware/res/raw/keyboard_layout_french.kcm
@@ -0,0 +1,336 @@
+# 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.
+
+#
+# French keyboard layout, AZERTY style.
+#
+
+type OVERLAY
+
+map key 16 A
+map key 17 Z
+map key 30 Q
+map key 39 M
+map key 44 W
+map key 50 COMMA
+map key 51 SEMICOLON
+map key 86 PLUS
+
+### ROW 1
+
+key GRAVE {
+ label: '\u00b2'
+ base: '\u00b2'
+}
+
+key 1 {
+ label: '1'
+ base: '&'
+ shift: '1'
+}
+
+key 2 {
+ label: '2'
+ base: '\u00e9'
+ shift: '2'
+ ralt: '~'
+}
+
+key 3 {
+ label: '3'
+ base: '"'
+ shift: '3'
+ ralt: '#'
+}
+
+key 4 {
+ label: '4'
+ base: '\''
+ shift: '4'
+ ralt: '{'
+}
+
+key 5 {
+ label: '5'
+ base: '('
+ shift: '5'
+ ralt: '['
+}
+
+key 6 {
+ label: '6'
+ base: '-'
+ shift: '6'
+ ralt: '|'
+}
+
+key 7 {
+ label: '7'
+ base: '\u00e8'
+ shift: '7'
+ ralt: '`'
+}
+
+key 8 {
+ label: '8'
+ base: '_'
+ shift: '8'
+ ralt: '\\'
+}
+
+key 9 {
+ label: '9'
+ base: '\u00e7'
+ shift: '9'
+ ralt: '^'
+}
+
+key 0 {
+ label: '0'
+ base: '\u00e0'
+ shift: '0'
+ ralt: '@'
+}
+
+key MINUS {
+ label: ')'
+ base: ')'
+ shift: '\u00b0'
+ ralt: ']'
+}
+
+key EQUALS {
+ label: '='
+ base: '='
+ shift: '+'
+ ralt: '}'
+}
+
+### ROW 2
+
+key A {
+ label: 'A'
+ base: 'a'
+ shift, capslock: 'A'
+}
+
+key Z {
+ label: 'Z'
+ base: 'z'
+ shift, capslock: 'Z'
+}
+
+key E {
+ label: 'E'
+ base: 'e'
+ shift, capslock: 'E'
+ ralt: '\u20ac'
+}
+
+key R {
+ label: 'R'
+ base: 'r'
+ shift, capslock: 'R'
+}
+
+key T {
+ label: 'T'
+ base: 't'
+ shift, capslock: 'T'
+}
+
+key Y {
+ label: 'Y'
+ base: 'y'
+ shift, capslock: 'Y'
+}
+
+key U {
+ label: 'U'
+ base: 'u'
+ shift, capslock: 'U'
+}
+
+key I {
+ label: 'I'
+ base: 'i'
+ shift, capslock: 'I'
+}
+
+key O {
+ label: 'O'
+ base: 'o'
+ shift, capslock: 'O'
+}
+
+key P {
+ label: 'P'
+ base: 'p'
+ shift, capslock: 'P'
+}
+
+key LEFT_BRACKET {
+ label: '\u02c6'
+ base: '\u0302'
+ shift: '\u0308'
+}
+
+key RIGHT_BRACKET {
+ label: '$'
+ base: '$'
+ shift: '\u00a3'
+ ralt: '\u00a4'
+}
+
+### ROW 3
+
+key Q {
+ label: 'Q'
+ base: 'q'
+ shift, capslock: 'Q'
+}
+
+key S {
+ label: 'S'
+ base: 's'
+ shift, capslock: 'S'
+}
+
+key D {
+ label: 'D'
+ base: 'd'
+ shift, capslock: 'D'
+}
+
+key F {
+ label: 'F'
+ base: 'f'
+ shift, capslock: 'F'
+}
+
+key G {
+ label: 'G'
+ base: 'g'
+ shift, capslock: 'G'
+}
+
+key H {
+ label: 'H'
+ base: 'h'
+ shift, capslock: 'H'
+}
+
+key J {
+ label: 'J'
+ base: 'j'
+ shift, capslock: 'J'
+}
+
+key K {
+ label: 'K'
+ base: 'k'
+ shift, capslock: 'K'
+}
+
+key L {
+ label: 'L'
+ base: 'l'
+ shift, capslock: 'L'
+}
+
+key M {
+ label: 'M'
+ base: 'm'
+ shift, capslock: 'M'
+}
+
+key APOSTROPHE {
+ label: '\u00f9'
+ base: '\u00f9'
+ shift: '%'
+}
+
+key BACKSLASH {
+ label: '*'
+ base: '*'
+ shift: '\u00b5'
+}
+
+### ROW 4
+
+key PLUS {
+ label: '<'
+ base: '<'
+ shift: '>'
+}
+
+key W {
+ label: 'W'
+ base: 'w'
+ shift, capslock: 'W'
+}
+
+key X {
+ label: 'X'
+ base: 'x'
+ shift, capslock: 'X'
+}
+
+key C {
+ label: 'C'
+ base: 'c'
+ shift, capslock: 'C'
+}
+
+key V {
+ label: 'V'
+ base: 'v'
+ shift, capslock: 'V'
+}
+
+key B {
+ label: 'B'
+ base: 'b'
+ shift, capslock: 'B'
+}
+
+key N {
+ label: 'N'
+ base: 'n'
+ shift, capslock: 'N'
+}
+
+key COMMA {
+ label: ','
+ base: ','
+ shift: '?'
+}
+
+key SEMICOLON {
+ label: ';'
+ base: ';'
+ shift: '.'
+}
+
+key PERIOD {
+ label: ':'
+ base: ':'
+ shift: '/'
+}
+
+key SLASH {
+ label: '!'
+ base: '!'
+ shift: '\u00a7'
+}
diff --git a/tests/tests/hardware/res/raw/keyboard_layout_german.kcm b/tests/tests/hardware/res/raw/keyboard_layout_german.kcm
new file mode 100644
index 00000000000..864af121245
--- /dev/null
+++ b/tests/tests/hardware/res/raw/keyboard_layout_german.kcm
@@ -0,0 +1,333 @@
+# 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.
+
+#
+# German keyboard layout, QWERTZ style.
+#
+
+type OVERLAY
+
+map key 12 SLASH # � ? \
+map key 21 Z
+map key 44 Y
+map key 53 MINUS # - _
+map key 86 PLUS # < > |
+
+### ROW 1
+
+key GRAVE {
+ label: '^'
+ base: '^'
+ shift: '\u00b0'
+}
+
+key 1 {
+ label: '1'
+ base: '1'
+ shift: '!'
+}
+
+key 2 {
+ label: '2'
+ base: '2'
+ shift: '"'
+ ralt: '\u00b2'
+}
+
+key 3 {
+ label: '3'
+ base: '3'
+ shift: '\u00a7'
+ ralt: '\u00b3'
+}
+
+key 4 {
+ label: '4'
+ base: '4'
+ shift: '$'
+}
+
+key 5 {
+ label: '5'
+ base: '5'
+ shift: '%'
+}
+
+key 6 {
+ label: '6'
+ base: '6'
+ shift: '&'
+}
+
+key 7 {
+ label: '7'
+ base: '7'
+ shift: '/'
+ ralt: '{'
+}
+
+key 8 {
+ label: '8'
+ base: '8'
+ shift: '('
+ ralt: '['
+}
+
+key 9 {
+ label: '9'
+ base: '9'
+ shift: ')'
+ ralt: ']'
+}
+
+key 0 {
+ label: '0'
+ base: '0'
+ shift: '='
+ ralt: '}'
+}
+
+key SLASH {
+ label: '\u00df'
+ base: '\u00df'
+ shift: '?'
+ ralt: '\\'
+}
+
+key EQUALS {
+ label: '\u00b4'
+ base: '\u0301'
+ shift: '\u0300'
+}
+
+### ROW 2
+
+key Q {
+ label: 'Q'
+ base: 'q'
+ shift, capslock: 'Q'
+ ralt: '@'
+}
+
+key W {
+ label: 'W'
+ base: 'w'
+ shift, capslock: 'W'
+}
+
+key E {
+ label: 'E'
+ base: 'e'
+ shift, capslock: 'E'
+ ralt: '\u20ac'
+}
+
+key R {
+ label: 'R'
+ base: 'r'
+ shift, capslock: 'R'
+}
+
+key T {
+ label: 'T'
+ base: 't'
+ shift, capslock: 'T'
+}
+
+key Z {
+ label: 'Z'
+ base: 'z'
+ shift, capslock: 'Z'
+}
+
+key U {
+ label: 'U'
+ base: 'u'
+ shift, capslock: 'U'
+}
+
+key I {
+ label: 'I'
+ base: 'i'
+ shift, capslock: 'I'
+}
+
+key O {
+ label: 'O'
+ base: 'o'
+ shift, capslock: 'O'
+}
+
+key P {
+ label: 'P'
+ base: 'p'
+ shift, capslock: 'P'
+}
+
+key LEFT_BRACKET {
+ label: '\u00dc'
+ base: '\u00fc'
+ shift, capslock: '\u00dc'
+}
+
+key RIGHT_BRACKET {
+ label: '+'
+ base: '+'
+ shift: '*'
+ ralt: '~'
+}
+
+### ROW 3
+
+key A {
+ label: 'A'
+ base: 'a'
+ shift, capslock: 'A'
+}
+
+key S {
+ label: 'S'
+ base: 's'
+ shift, capslock: 'S'
+}
+
+key D {
+ label: 'D'
+ base: 'd'
+ shift, capslock: 'D'
+}
+
+key F {
+ label: 'F'
+ base: 'f'
+ shift, capslock: 'F'
+}
+
+key G {
+ label: 'G'
+ base: 'g'
+ shift, capslock: 'G'
+}
+
+key H {
+ label: 'H'
+ base: 'h'
+ shift, capslock: 'H'
+}
+
+key J {
+ label: 'J'
+ base: 'j'
+ shift, capslock: 'J'
+}
+
+key K {
+ label: 'K'
+ base: 'k'
+ shift, capslock: 'K'
+}
+
+key L {
+ label: 'L'
+ base: 'l'
+ shift, capslock: 'L'
+}
+
+key SEMICOLON {
+ label: '\u00d6'
+ base: '\u00f6'
+ shift, capslock: '\u00d6'
+}
+
+key APOSTROPHE {
+ label: '\u00c4'
+ base: '\u00e4'
+ shift, capslock: '\u00c4'
+}
+
+key BACKSLASH {
+ label: '#'
+ base: '#'
+ shift: '\''
+}
+
+### ROW 4
+
+key PLUS {
+ label: '<'
+ base: '<'
+ shift: '>'
+ ralt: '|'
+}
+
+key Y {
+ label: 'Y'
+ base: 'y'
+ shift, capslock: 'Y'
+}
+
+key X {
+ label: 'X'
+ base: 'x'
+ shift, capslock: 'X'
+}
+
+key C {
+ label: 'C'
+ base: 'c'
+ shift, capslock: 'C'
+}
+
+key V {
+ label: 'V'
+ base: 'v'
+ shift, capslock: 'V'
+}
+
+key B {
+ label: 'B'
+ base: 'b'
+ shift, capslock: 'B'
+}
+
+key N {
+ label: 'N'
+ base: 'n'
+ shift, capslock: 'N'
+}
+
+key M {
+ label: 'M'
+ base: 'm'
+ shift, capslock: 'M'
+ ralt: '\u00b5'
+}
+
+key COMMA {
+ label: ','
+ base: ','
+ shift: ';'
+}
+
+key PERIOD {
+ label: '.'
+ base: '.'
+ shift: ':'
+}
+
+key MINUS {
+ label: '-'
+ base: '-'
+ shift: '_'
+}
diff --git a/tests/tests/hardware/res/xml/keyboard_layouts.xml b/tests/tests/hardware/res/xml/keyboard_layouts.xml
new file mode 100644
index 00000000000..4516a368bac
--- /dev/null
+++ b/tests/tests/hardware/res/xml/keyboard_layouts.xml
@@ -0,0 +1,31 @@
+<?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.
+ -->
+
+<keyboard-layouts xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <keyboard-layout android:name="keyboard_layout_english_us"
+ android:label="English (US)"
+ android:keyboardLayout="@raw/keyboard_layout_english_us" />
+
+ <keyboard-layout android:name="keyboard_layout_german"
+ android:label="German"
+ android:keyboardLayout="@raw/keyboard_layout_german" />
+
+ <keyboard-layout android:name="keyboard_layout_french"
+ android:label="French"
+ android:keyboardLayout="@raw/keyboard_layout_french" />
+</keyboard-layouts>
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/KeyboardLayoutChangeTest.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/KeyboardLayoutChangeTest.java
index 7dae1d1e2ca..a12730ce7cf 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/KeyboardLayoutChangeTest.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/KeyboardLayoutChangeTest.java
@@ -26,6 +26,9 @@ import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.timeout;
import android.Manifest;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
import android.hardware.cts.R;
import android.hardware.input.InputManager;
import android.os.Handler;
@@ -36,6 +39,7 @@ import android.view.KeyEvent;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
+import com.android.compatibility.common.util.ApiTest;
import com.android.compatibility.common.util.SystemUtil;
import org.junit.Test;
@@ -44,6 +48,7 @@ import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+@ApiTest(apis = {"android.view.InputDevice#getKeyCodeForKeyLocation"})
@SmallTest
@RunWith(AndroidJUnit4.class)
public class KeyboardLayoutChangeTest extends InputHidTestCase {
@@ -201,4 +206,11 @@ public class KeyboardLayoutChangeTest extends InputHidTestCase {
timeout(KEYBOARD_LAYOUT_CHANGE_TIMEOUT)).onInputDeviceChanged(
eq(device.getId()));
}
+
+ public static class CtsKeyboardLayoutProvider extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ // Nothing to do at this time.
+ }
+ }
}
diff --git a/tests/tests/media/codec/src/android/media/codec/cts/MediaCodecResourceTest.java b/tests/tests/media/codec/src/android/media/codec/cts/MediaCodecResourceTest.java
index 3bd9db68f5a..663ee1a80cd 100644
--- a/tests/tests/media/codec/src/android/media/codec/cts/MediaCodecResourceTest.java
+++ b/tests/tests/media/codec/src/android/media/codec/cts/MediaCodecResourceTest.java
@@ -308,8 +308,8 @@ public class MediaCodecResourceTest {
new IntentFilter(ACTION_LOW_PRIORITY_SERVICE_READY));
Intent intent = new Intent(context, MediaCodecResourceTestLowPriorityService.class);
context.startForegroundService(intent);
- // Starting the service and receiving the broadcast should take less than 1 second
- ProcessInfo processInfo = processInfoBroadcastReceiver.waitForProcessInfoMs(1000);
+ // Starting the service and receiving the broadcast should take less than 5 seconds
+ ProcessInfo processInfo = processInfoBroadcastReceiver.waitForProcessInfoMs(5000);
context.unregisterReceiver(processInfoBroadcastReceiver);
return processInfo;
}
@@ -323,8 +323,8 @@ public class MediaCodecResourceTest {
Intent intent = new Intent(context, MediaCodecResourceTestHighPriorityActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(intent);
- // Starting the activity and receiving the broadcast should take less than 1 second
- ProcessInfo processInfo = processInfoBroadcastReceiver.waitForProcessInfoMs(1000);
+ // Starting the activity and receiving the broadcast should take less than 5 seconds
+ ProcessInfo processInfo = processInfoBroadcastReceiver.waitForProcessInfoMs(5000);
context.unregisterReceiver(processInfoBroadcastReceiver);
return processInfo;
}