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 import static org.junit.Assume.assumeTrue; 21 22 import android.platform.test.annotations.AsbSecurityTest; 23 24 import com.android.sts.common.tradefed.testtype.StsExtraBusinessLogicHostTestBase; 25 import com.android.tradefed.device.ITestDevice; 26 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; 27 28 import org.junit.Test; 29 import org.junit.runner.RunWith; 30 31 @RunWith(DeviceJUnit4ClassRunner.class) 32 public class CVE_2022_20116 extends StsExtraBusinessLogicHostTestBase { 33 34 @AsbSecurityTest(cveBugId = 212467440) 35 @Test testPocCVE_2022_20223()36 public void testPocCVE_2022_20223() { 37 ITestDevice device = getDevice(); 38 final String testPkg = "android.security.cts.CVE_2022_20116"; 39 try { 40 // Wake up the screen 41 AdbUtils.runCommandLine("input keyevent KEYCODE_WAKEUP", device); 42 AdbUtils.runCommandLine("input keyevent KEYCODE_MENU", device); 43 AdbUtils.runCommandLine("input keyevent KEYCODE_HOME", device); 44 45 // Install PoC application 46 installPackage("CVE-2022-20116.apk"); 47 48 runDeviceTests(testPkg, testPkg + ".DeviceTest", "testOngoingCallController"); 49 } catch (Exception e) { 50 assumeNoException(e); 51 } finally { 52 try { 53 // Back to home screen after test 54 AdbUtils.runCommandLine("input keyevent KEYCODE_HOME", device); 55 } catch (Exception e) { 56 // ignore exceptions here 57 } 58 } 59 } 60 } 61