1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.security.cts; 18 19 import static org.junit.Assume.assumeNoException; 20 21 import android.platform.test.annotations.AsbSecurityTest; 22 23 import com.android.sts.common.tradefed.testtype.NonRootSecurityTestCase; 24 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; 25 26 import org.junit.After; 27 import org.junit.Before; 28 import org.junit.Test; 29 import org.junit.runner.RunWith; 30 31 @RunWith(DeviceJUnit4ClassRunner.class) 32 public class TestBluetoothDiscoverable extends NonRootSecurityTestCase { 33 private final String mTestPkg = "android.security.cts.TestBluetoothDiscoverable"; 34 private final String mTestClass = mTestPkg + "." + "DeviceTest"; 35 36 @Before setUp()37 public void setUp() { 38 try { 39 // Install test app 40 installPackage("TestBluetoothDiscoverable.apk"); 41 } catch (Exception e) { 42 assumeNoException(e); 43 } 44 } 45 46 @After tearDown()47 public void tearDown() { 48 try { 49 // Back to home screen after test 50 AdbUtils.runCommandLine("input keyevent KEYCODE_HOME", getDevice()); 51 } catch (Exception e) { 52 // Ignore exceptions here 53 } 54 } 55 56 57 // b/228450811 58 // Vulnerable module : com.android.settings 59 // Vulnerable apk : Settings.apk 60 // Is play managed : No 61 @AsbSecurityTest(cveBugId = 228450811) 62 @Test testPocCVE_2022_20347()63 public void testPocCVE_2022_20347() { 64 try { 65 runDeviceTests(mTestPkg, mTestClass, "testConnectedDeviceDashboardFragment"); 66 } catch (Exception e) { 67 assumeNoException(e); 68 } 69 } 70 71 // b/244423101 72 // Vulnerable module : com.android.settings 73 // Vulnerable apk : Settings.apk 74 // Is play managed : No 75 @AsbSecurityTest(cveBugId = 244423101) 76 @Test testPocCVE_2023_20946()77 public void testPocCVE_2023_20946() { 78 try { 79 runDeviceTests(mTestPkg, mTestClass, "testBluetoothDashboardFragment"); 80 } catch (Exception e) { 81 assumeNoException(e); 82 } 83 } 84 } 85