Merge "Adapt MediaStorageTest for watches" into android13-tests-dev am: 98c957bde6 am: eef70ad719
Original change: https://android-review.googlesource.com/c/platform/cts/+/2497835
Change-Id: I2a4e36e8cf6124fda4ded0e060dcb72910451243
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/hostsidetests/scopedstorage/Android.bp b/hostsidetests/scopedstorage/Android.bp
index 4453beb..527e8ef 100644
--- a/hostsidetests/scopedstorage/Android.bp
+++ b/hostsidetests/scopedstorage/Android.bp
@@ -303,7 +303,6 @@
"general-tests",
"mts-mediaprovider",
"cts",
- "gts"
],
test_config: "AndroidTest.xml",
per_testcase_directory: true,
diff --git a/hostsidetests/scopedstorage/AndroidTest.xml b/hostsidetests/scopedstorage/AndroidTest.xml
index 12e4e16..320d541 100644
--- a/hostsidetests/scopedstorage/AndroidTest.xml
+++ b/hostsidetests/scopedstorage/AndroidTest.xml
@@ -15,7 +15,6 @@
-->
<configuration description="External storage host test for legacy and scoped storage">
<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="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
diff --git a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageHostTest.java b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageHostTest.java
index 46a29bd..cd9378d 100644
--- a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageHostTest.java
+++ b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageHostTest.java
@@ -20,11 +20,7 @@
import android.platform.test.annotations.AppModeFull;
-import com.android.compatibility.common.util.CtsDownstreamingTest;
-import com.android.modules.utils.build.testing.DeviceSdkLevel;
-import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.DeviceTestRunOptions;
@@ -149,48 +145,26 @@
}
@Test
- @CtsDownstreamingTest
public void testCheckInstallerAppAccessToObbDirs() throws Exception {
- CLog.i("IF THIS TEST FAILS GTS, please check if your build includes "
- + "the following critical Android T patch: "
- + "https://docs.partner.android.com/gms/policies/bulletins/sep-2022#239495492");
-
allowAppOps("android:request_install_packages");
- // WRITE_EXTERNAL_STORAGE is no-op for Installers T onwards
- if (isSdkLevelLessThanT()) {
- grantPermissions("android.permission.WRITE_EXTERNAL_STORAGE");
- }
+ grantPermissions("android.permission.WRITE_EXTERNAL_STORAGE");
try {
runDeviceTest("testCheckInstallerAppAccessToObbDirs");
} finally {
denyAppOps("android:request_install_packages");
- // WRITE_EXTERNAL_STORAGE is no-op for Installers T onwards
- if (isSdkLevelLessThanT()) {
- revokePermissions("android.permission.WRITE_EXTERNAL_STORAGE");
- }
+ revokePermissions("android.permission.WRITE_EXTERNAL_STORAGE");
}
}
@Test
- @CtsDownstreamingTest
public void testCheckInstallerAppCannotAccessDataDirs() throws Exception {
- CLog.i("IF THIS TEST FAILS GTS, please check if your build includes "
- + "the following critical Android T patch: "
- + "https://docs.partner.android.com/gms/policies/bulletins/sep-2022#239495492");
-
allowAppOps("android:request_install_packages");
- // WRITE_EXTERNAL_STORAGE is no-op for Installers T onwards
- if (isSdkLevelLessThanT()) {
- grantPermissions("android.permission.WRITE_EXTERNAL_STORAGE");
- }
+ grantPermissions("android.permission.WRITE_EXTERNAL_STORAGE");
try {
runDeviceTest("testCheckInstallerAppCannotAccessDataDirs");
} finally {
denyAppOps("android:request_install_packages");
- // WRITE_EXTERNAL_STORAGE is no-op for Installers T onwards
- if (isSdkLevelLessThanT()) {
- revokePermissions("android.permission.WRITE_EXTERNAL_STORAGE");
- }
+ revokePermissions("android.permission.WRITE_EXTERNAL_STORAGE");
}
}
@@ -415,9 +389,4 @@
executeShellCommand("cmd appops set --uid android.scopedstorage.cts " + op + " deny");
}
}
-
- private boolean isSdkLevelLessThanT() throws DeviceNotAvailableException {
- DeviceSdkLevel deviceSdkLevel = new DeviceSdkLevel(getDevice());
- return !deviceSdkLevel.isDeviceAtLeastT();
- }
}
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 d0e11d6..d425363 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_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;
@@ -486,6 +487,7 @@
assertTrue(mWmState.getKeyguardControllerState().keyguardShowing);
assertFalse(isDisplayOn(DEFAULT_DISPLAY));
}
+
/**
* Tests whether a FLAG_DISMISS_KEYGUARD activity occludes Keyguard.
*/
@@ -561,6 +563,20 @@
}
@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/src/android/server/wm/KeyguardTransitionTests.java b/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTransitionTests.java
index 4463efe..ab08a11 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTransitionTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTransitionTests.java
@@ -106,6 +106,15 @@
}
@Test
+ public void testDismissKeyguard() {
+ createManagedLockScreenSession().gotoKeyguard();
+ launchActivityWithDismissKeyguard(SHOW_WHEN_LOCKED_NO_PREVIEW_ACTIVITY);
+ mWmState.computeState(SHOW_WHEN_LOCKED_NO_PREVIEW_ACTIVITY);
+ assertEquals("Picked wrong transition", TRANSIT_KEYGUARD_GOING_AWAY,
+ mWmState.getDefaultDisplayLastTransition());
+ }
+
+ @Test
public void testNewActivityDuringOccluded() {
final LockScreenSession lockScreenSession = createManagedLockScreenSession();
launchActivity(SHOW_WHEN_LOCKED_NO_PREVIEW_ACTIVITY);
@@ -117,6 +126,18 @@
}
@Test
+ public void testNewDismissKeyguardActivityDuringOccluded() {
+ final LockScreenSession lockScreenSession = createManagedLockScreenSession();
+ launchActivity(SHOW_WHEN_LOCKED_NO_PREVIEW_ACTIVITY);
+ lockScreenSession.gotoKeyguard(SHOW_WHEN_LOCKED_NO_PREVIEW_ACTIVITY);
+ launchActivityWithDismissKeyguard(
+ SHOW_WHEN_LOCKED_WITH_DIALOG_NO_PREVIEW_ACTIVITY);
+ mWmState.computeState(SHOW_WHEN_LOCKED_WITH_DIALOG_NO_PREVIEW_ACTIVITY);
+ assertEquals("Picked wrong transition", TRANSIT_ACTIVITY_OPEN,
+ mWmState.getDefaultDisplayLastTransition());
+ }
+
+ @Test
public void testOccludeManifestAttr() {
final LockScreenSession lockScreenSession = createManagedLockScreenSession();
lockScreenSession.gotoKeyguard();
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationSynchronicityTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationSynchronicityTests.java
index 51033bb..bb83db1 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationSynchronicityTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationSynchronicityTests.java
@@ -64,7 +64,6 @@
import com.android.compatibility.common.util.SystemUtil;
import com.android.compatibility.common.util.WindowUtil;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
@@ -84,13 +83,11 @@
private final Context mContext = InstrumentationRegistry.getInstrumentation().getContext();
- @Ignore("b/168446060")
@Test
public void testShowAndHide_renderSynchronouslyBetweenImeWindowAndAppContent() throws Throwable {
runTest(false /* useControlApi */);
}
- @Ignore("b/168446060")
@Test
public void testControl_rendersSynchronouslyBetweenImeWindowAndAppContent() throws Throwable {
runTest(true /* useControlApi */);
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 bfb3e88..2c6a21f 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
@@ -334,9 +334,9 @@
return "am start --activity-task-on-home -n " + getActivityName(activityName);
}
- protected static String getAmStartCmdWithDismissKeyguardIfInsecure(
+ protected static String getAmStartCmdWithDismissKeyguard(
final ComponentName activityName) {
- return "am start --dismiss-keyguard-if-insecure -n " + getActivityName(activityName);
+ return "am start --dismiss-keyguard -n " + getActivityName(activityName);
}
protected static String getAmStartCmdWithNoUserAction(final ComponentName activityName,
@@ -824,8 +824,8 @@
mWmState.waitForValidState(activityName);
}
- protected void launchActivityWithDismissKeyguardIfInsecure(final ComponentName activityName) {
- executeShellCommand(getAmStartCmdWithDismissKeyguardIfInsecure(activityName));
+ protected void launchActivityWithDismissKeyguard(final ComponentName activityName) {
+ executeShellCommand(getAmStartCmdWithDismissKeyguard(activityName));
mWmState.waitForValidState(activityName);
}
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 d009abd..6f6edf9 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
@@ -1813,12 +1813,14 @@
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 9a3c1ec..0913831 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
@@ -699,6 +699,8 @@
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));
}
@@ -706,6 +708,8 @@
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/telecom/src/android/telecom/cts/PhoneAccountRegistrarTest.java b/tests/tests/telecom/src/android/telecom/cts/PhoneAccountRegistrarTest.java
index 80905dc..451d4e3 100644
--- a/tests/tests/telecom/src/android/telecom/cts/PhoneAccountRegistrarTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/PhoneAccountRegistrarTest.java
@@ -53,7 +53,7 @@
// PhoneAccountRegistrar called MAX_PHONE_ACCOUNT_REGISTRATIONS
// permissions
- private static final String READ_PRIVILEGED_PHONE_STATE =
+ private static final String READ_PHONE_STATE_PERMISSION =
"android.permission.READ_PRIVILEGED_PHONE_STATE";
private static final String MODIFY_PHONE_STATE_PERMISSION =
"android.permission.MODIFY_PHONE_STATE";
@@ -237,87 +237,7 @@
}
}
// unbind from second package
- mContext.unbindService(control);
- }
-
- /*
- * Ensure an app does not register accounts over the upper bound limit by disabling them
- */
- public void testDisablingAccountsAfterRegStillThrowsException() throws Exception {
- if (!mShouldTestTelecom) return;
-
- // ensure the test starts without any phone accounts registered to the test package
- cleanupPhoneAccounts();
-
- // Create MAX_PHONE_ACCOUNT_REGISTRATIONS + 1 via helper function
- ArrayList<PhoneAccount> accounts = TestUtils.generateRandomPhoneAccounts(SEED,
- MAX_PHONE_ACCOUNT_REGISTRATIONS + 1, TestUtils.PACKAGE,
- TestUtils.COMPONENT);
-
- try {
- // Try to register more phone accounts than allowed by the upper bound limit
- for (PhoneAccount pa : accounts) {
- mTelecomManager.registerPhoneAccount(pa);
- TestUtils.disablePhoneAccount(getInstrumentation(), pa.getAccountHandle());
- // verify the account is both registered and disabled
- verifyAccountIsDisabled(pa);
- }
-
- // A successful test should never reach this line of execution.
- // However, if it does, fail the test by throwing a fail(...)
- fail("Test failed. The test did not throw an IllegalArgumentException when "
- + "registering phone accounts over the upper bound: "
- + "MAX_PHONE_ACCOUNT_REGISTRATIONS");
- } catch (IllegalArgumentException e) {
- // Assert the IllegalArgumentException was thrown
- assertNotNull(e.toString());
- } finally {
- // Cleanup accounts registered
- accounts.stream().forEach(d -> mTelecomManager.unregisterPhoneAccount(
- d.getAccountHandle()));
- }
- }
-
- /**
- * Ensure an app does not register accounts that will be auto-disabled upon registered and
- * bypass the limit. Note: CAPABILITY_CALL_PROVIDER will register the account as disabled.
- */
- public void testDisabledAccountsThrowsException() throws Exception {
- if (!mShouldTestTelecom) return;
-
- // ensure the test starts without any phone accounts registered to the test package
- cleanupPhoneAccounts();
-
- // Create MAX_PHONE_ACCOUNT_REGISTRATIONS + 1
- ArrayList<PhoneAccount> accounts = new ArrayList<>();
- for (int i = 0; i < MAX_PHONE_ACCOUNT_REGISTRATIONS + 1; i++) {
- accounts.add(new PhoneAccount.Builder(
- TestUtils.makePhoneAccountHandle(Integer.toString(i)),
- TestUtils.ACCOUNT_LABEL)
- .setCapabilities(CAPABILITY_CALL_PROVIDER)
- .build());
- }
-
- try {
- // Try to register more phone accounts than allowed by the upper bound limit
- for (PhoneAccount pa : accounts) {
- mTelecomManager.registerPhoneAccount(pa);
- // verify the account is both registered and disabled
- verifyAccountIsDisabled(pa);
- }
- // A successful test should never reach this line of execution.
- // However, if it does, fail the test by throwing a fail(...)
- fail("Test failed. The test did not throw an IllegalArgumentException when "
- + "registering phone accounts over the upper bound: "
- + "MAX_PHONE_ACCOUNT_REGISTRATIONS");
- } catch (IllegalArgumentException e) {
- // Assert the IllegalArgumentException was thrown
- assertNotNull(e.toString());
- } finally {
- // Cleanup accounts registered
- accounts.stream().forEach(d -> mTelecomManager.unregisterPhoneAccount(
- d.getAccountHandle()));
- }
+ mContext.unbindService(control);
}
/**
@@ -581,12 +501,6 @@
}
}
- public void verifyAccountIsDisabled(PhoneAccount account) {
- PhoneAccount phoneAccount = mTelecomManager.getPhoneAccount(account.getAccountHandle());
- assertNotNull(phoneAccount);
- assertFalse(phoneAccount.isEnabled());
- }
-
public void verifyCanFetchCallCapableAccounts() {
List<PhoneAccountHandle> res =
mTelecomManager.getCallCapablePhoneAccounts(true);
@@ -678,9 +592,10 @@
if (mTelecomManager != null) {
// Get all handles registered to the testing package
List<PhoneAccountHandle> handles =
- ShellIdentityUtils.invokeMethodWithShellPermissions(mTelecomManager,
- (tm) -> tm.getPhoneAccountsForPackage(),
- READ_PRIVILEGED_PHONE_STATE);
+ ShellIdentityUtils.invokeMethodWithShellPermissions(
+ mTelecomManager, (tm) -> tm.getPhoneAccountsForPackage(),
+ READ_PHONE_STATE_PERMISSION);
+
// cleanup any extra phone accounts registered to the testing package
if (handles.size() > 0 && mTelecomManager != null) {
handles.stream().forEach(
@@ -702,9 +617,9 @@
*/
private int getNumberOfPhoneAccountsRegisteredToTestPackage() {
if (mTelecomManager != null) {
- return ShellIdentityUtils.invokeMethodWithShellPermissions(mTelecomManager,
- (tm) -> tm.getPhoneAccountsForPackage(),
- READ_PRIVILEGED_PHONE_STATE).size();
+ return ShellIdentityUtils.invokeMethodWithShellPermissions(
+ mTelecomManager, (tm) -> tm.getPhoneAccountsForPackage(),
+ READ_PHONE_STATE_PERMISSION).size();
}
return 0;
}
diff --git a/tests/tests/telecom/src/android/telecom/cts/TestUtils.java b/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
index c79c10e..59d2394 100644
--- a/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
+++ b/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
@@ -81,8 +81,6 @@
public static final String ACCOUNT_ID_SIM = "sim_acct";
public static final String ACCOUNT_ID_EMERGENCY = "xtstest_CALL_PROVIDER_EMERGENCY";
public static final String EXTRA_PHONE_NUMBER = "android.telecom.cts.extra.PHONE_NUMBER";
- public static final ComponentName TELECOM_CTS_COMPONENT_NAME = new ComponentName(
- TestUtils.PACKAGE, TestUtils.COMPONENT);
public static final PhoneAccountHandle TEST_PHONE_ACCOUNT_HANDLE =
new PhoneAccountHandle(new ComponentName(PACKAGE, COMPONENT), ACCOUNT_ID_1);
public static final PhoneAccountHandle TEST_SIM_PHONE_ACCOUNT_HANDLE =
@@ -324,8 +322,6 @@
private static final String COMMAND_ENABLE = "telecom set-phone-account-enabled ";
- private static final String COMMAND_DISABLE = "telecom set-phone-account-disabled ";
-
private static final String COMMAND_SET_ACCT_SUGGESTION =
"telecom set-phone-acct-suggestion-component ";
@@ -407,15 +403,6 @@
+ handle.getId() + " " + currentUserSerial);
}
- public static void disablePhoneAccount(Instrumentation instrumentation,
- PhoneAccountHandle handle) throws Exception {
- final ComponentName component = handle.getComponentName();
- final long currentUserSerial = getCurrentUserSerialNumber(instrumentation);
- executeShellCommand(instrumentation, COMMAND_DISABLE
- + component.getPackageName() + "/" + component.getClassName() + " "
- + handle.getId() + " " + currentUserSerial);
- }
-
public static void registerSimPhoneAccount(Instrumentation instrumentation,
PhoneAccountHandle handle, String label, String address) throws Exception {
final ComponentName component = handle.getComponentName();
@@ -874,7 +861,5 @@
return UUID.nameUUIDFromBytes(array);
}
- public static PhoneAccountHandle makePhoneAccountHandle(String id) {
- return new PhoneAccountHandle(TELECOM_CTS_COMPONENT_NAME, id);
- }
+
}
diff --git a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java
index 94a65bf..f4abe76 100644
--- a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java
+++ b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java
@@ -105,6 +105,7 @@
BINARY_EXCEPTIONS.add("img2simg");
BINARY_EXCEPTIONS.add("lpmake");
BINARY_EXCEPTIONS.add("lpunpack");
+ BINARY_EXCEPTIONS.add("mk_payload");
BINARY_EXCEPTIONS.add("sign_virt_apex");
BINARY_EXCEPTIONS.add("simg2img");
}