/* * 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.server.wm; import static android.server.wm.ShellCommandHelper.executeShellCommand; import static android.server.wm.UiDeviceUtils.pressBackButton; import static android.server.wm.deprecatedabi.Components.WARNING_DIALOG_ACTIVITY; import static org.junit.Assume.assumeTrue; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.SystemProperties; import android.platform.test.annotations.Presubmit; import com.android.compatibility.common.util.ApiTest; import com.android.compatibility.common.util.SystemUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.util.Arrays; import java.util.List; /** * Ensure that compatibility dialog is shown when launching an application * targeting a deprecated ABI. *
Build/Install/Run:
* atest CtsWindowManagerDeviceTestCases:DeprecatedAbiTest
*/
@Presubmit
@ApiTest(apis = {"android.content.pm.PackageInstaller#STATUS_FAILURE_INCOMPATIBLE"})
public class DeprecatedAbiTest extends ActivityManagerTestBase {
/** @see com.android.server.wm.DeprecatedAbiDialog */
private static final String DEPRECATED_ABI_DIALOG =
"DeprecatedAbiDialog";
private static final String TEST_APK_PATH = "/data/local/tmp/cts/CtsDeviceDeprecatedAbiApp.apk";
private static final String TEST_PACKAGE_NAME = "android.server.wm.deprecatedabi";
@Before
public void setUp() {
SystemUtil.runShellCommand("input keyevent KEYCODE_WAKEUP");
SystemUtil.runShellCommand("wm dismiss-keyguard");
SystemUtil.runShellCommand("setprop debug.wm.disable_deprecated_abi_dialog 0");
}
@After
public void tearDown() {
// Ensure app process is stopped.
stopTestPackage(WARNING_DIALOG_ACTIVITY.getPackageName());
executeShellCommand("pm uninstall " + TEST_PACKAGE_NAME);
// Continue to disable DeprecatedAbi dialog so other tests can pass
SystemUtil.runShellCommand("setprop debug.wm.disable_deprecated_abi_dialog 1");
}
@Test
public void testWarningDialog() throws Exception {
// Skip the test if the device only supports 32-bit ABI
List