Merge "[DO NOT MERGE] TouchExplorerTest: remove test for long clicking using accessibility actions." into rvc-dev
diff --git a/hostsidetests/appcompat/host/lib/src/android/compat/cts/CompatChangeGatingTestCase.java b/hostsidetests/appcompat/host/lib/src/android/compat/cts/CompatChangeGatingTestCase.java
index 07a51af1d..d637ff0 100644
--- a/hostsidetests/appcompat/host/lib/src/android/compat/cts/CompatChangeGatingTestCase.java
+++ b/hostsidetests/appcompat/host/lib/src/android/compat/cts/CompatChangeGatingTestCase.java
@@ -226,7 +226,8 @@
StatsdConfigProto.StatsdConfig.Builder configBuilder =
StatsdConfigProto.StatsdConfig.newBuilder()
.setId(configId)
- .addAllowedLogSource(pkgName);
+ .addAllowedLogSource(pkgName)
+ .addWhitelistedAtomIds(Atom.APP_COMPATIBILITY_CHANGE_REPORTED_FIELD_NUMBER);
StatsdConfigProto.SimpleAtomMatcher.Builder simpleAtomMatcherBuilder =
StatsdConfigProto.SimpleAtomMatcher
.newBuilder().setAtomId(
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTest.java
index fc63925..fc97c75 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTest.java
@@ -28,6 +28,7 @@
*/
public class DocumentsTest extends DocumentsTestCase {
private static final String PROVIDER_PKG = "com.android.cts.documentprovider";
+ private static final String DUMMYIME_PKG = "com.android.cts.dummyime";
private static final String PROVIDER_APK = "CtsDocumentProvider.apk";
private static final String DUMMYIME_APK = "CtsDummyIme.apk";
@@ -48,7 +49,7 @@
super.tearDown();
getDevice().uninstallPackage(PROVIDER_PKG);
- getDevice().uninstallPackage(DUMMYIME_APK);
+ getDevice().uninstallPackage(DUMMYIME_PKG);
}
public void testOpenSimple() throws Exception {
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
index 40d8ff4..03746fe 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
@@ -713,6 +713,7 @@
final Uri rootsUri = DocumentsContract.buildRootsUri(PROVIDER_PACKAGE);
final Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setPackage(getDocumentsUiPackageId());
intent.setDataAndType(rootsUri, "vnd.android.document/root");
mActivity.startActivity(intent);
mDevice.waitForIdle();
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
index 72e8293..5beb487 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
@@ -726,6 +726,7 @@
try {
// Install and enable assistant, notice that profile can't have assistant.
installAppAsUser(ASSIST_APP_APK, mPrimaryUserId);
+ waitForBroadcastIdle();
setVoiceInteractionService(ASSIST_INTERACTION_SERVICE);
setScreenCaptureDisabled_assist(mUserId, true /* disabled */);
} finally {
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/CecMessage.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/CecMessage.java
index 6437ec0..8d4ece1 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/CecMessage.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/CecMessage.java
@@ -67,4 +67,15 @@
private CecMessage(int messageId) {
this.messageId = messageId;
}
+
+ public static String formatParams(long rawParam) {
+ StringBuilder params = new StringBuilder("");
+
+ do {
+ params.insert(0, ":" + String.format("%02x", rawParam % 256));
+ rawParam >>= 8;
+ } while (rawParam > 0);
+
+ return params.toString();
+ }
}
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java
index 3ac2e5f..5162a27 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java
@@ -64,6 +64,8 @@
@Test
public void cect_11_2_15_11_VolumeUpDownUserControlPressed() throws Exception {
ITestDevice device = getDevice();
+ hdmiCecClient.sendCecMessage(CecDevice.AUDIO_SYSTEM, CecDevice.BROADCAST,
+ CecMessage.SET_SYSTEM_AUDIO_MODE, CecMessage.formatParams(1));
device.executeShellCommand("input keyevent KEYCODE_VOLUME_UP");
String message = hdmiCecClient.checkExpectedOutput(CecDevice.AUDIO_SYSTEM,
CecMessage.USER_CONTROL_PRESSED);
@@ -89,7 +91,9 @@
@Test
public void cect_11_2_15_12_MuteUserControlPressed() throws Exception {
ITestDevice device = getDevice();
- device.executeShellCommand("input keyevent KEYCODE_MUTE");
+ hdmiCecClient.sendCecMessage(CecDevice.AUDIO_SYSTEM, CecDevice.BROADCAST,
+ CecMessage.SET_SYSTEM_AUDIO_MODE, CecMessage.formatParams(1));
+ device.executeShellCommand("input keyevent KEYCODE_VOLUME_MUTE");
String message = hdmiCecClient.checkExpectedOutput(CecDevice.AUDIO_SYSTEM,
CecMessage.USER_CONTROL_PRESSED);
assertEquals(HdmiCecConstants.CEC_CONTROL_MUTE,
diff --git a/hostsidetests/incrementalinstall/app/Android.bp b/hostsidetests/incrementalinstall/app/Android.bp
index 483011e..85a8be1 100644
--- a/hostsidetests/incrementalinstall/app/Android.bp
+++ b/hostsidetests/incrementalinstall/app/Android.bp
@@ -33,6 +33,10 @@
export_package_resources: true,
aapt_include_all_resources: true,
manifest: "AndroidManifestV1.xml",
+
+ // This flag allow the native lib to be compressed in the apk or associated split apk, and
+ // needs to be extracted by the installer instead of calling directly into the apk.
+ use_embedded_native_libs: false,
}
// v2 implementation of test app built with v1 manifest for zero version update test.
diff --git a/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/DeviceOwnerTest.java b/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/DeviceOwnerTest.java
index 842d83a..3442ce1 100644
--- a/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/DeviceOwnerTest.java
+++ b/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/DeviceOwnerTest.java
@@ -77,6 +77,13 @@
} catch (RemoteException e) {
throw new RuntimeException("failed to freeze device orientation", e);
}
+ wakeupDeviceAndPressHome();
+ }
+
+ private void wakeupDeviceAndPressHome() throws Exception {
+ mDevice.wakeUp();
+ mDevice.pressMenu();
+ mDevice.pressHome();
}
@Override
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java b/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
index 51e24ea..317c0d4 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
@@ -241,7 +241,8 @@
.addAllowedLogSource("AID_STATSD")
.addAllowedLogSource(DeviceAtomTestCase.DEVICE_SIDE_TEST_PACKAGE)
.addDefaultPullPackages("AID_RADIO")
- .addDefaultPullPackages("AID_SYSTEM");
+ .addDefaultPullPackages("AID_SYSTEM")
+ .addWhitelistedAtomIds(Atom.APP_BREADCRUMB_REPORTED_FIELD_NUMBER);
}
protected void createAndUploadConfig(int atomTag) throws Exception {
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/DatasetFilteringInlineTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/DatasetFilteringInlineTest.java
index e303321..036e744 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/DatasetFilteringInlineTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/DatasetFilteringInlineTest.java
@@ -22,11 +22,19 @@
import android.autofillservice.cts.DatasetFilteringTest;
import android.autofillservice.cts.Helper;
+import org.junit.rules.TestRule;
+
public class DatasetFilteringInlineTest extends DatasetFilteringTest {
public DatasetFilteringInlineTest() {
super(getInlineUiBot());
}
+
+ @Override
+ public TestRule getMainTestRule() {
+ return InlineUiBot.annotateRule(super.getMainTestRule());
+ }
+
@Override
protected boolean isInlineMode() {
return true;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedLoginActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedLoginActivityTest.java
index d645834..332c645 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedLoginActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedLoginActivityTest.java
@@ -43,6 +43,7 @@
import android.widget.EditText;
import org.junit.Test;
+import org.junit.rules.TestRule;
import java.util.List;
@@ -66,6 +67,11 @@
};
}
+ @Override
+ public TestRule getMainTestRule() {
+ return InlineUiBot.annotateRule(super.getMainTestRule());
+ }
+
@Test
public void testAugmentedAutoFill_oneDatasetThenFilled() throws Exception {
// Set services
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAuthenticationTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAuthenticationTest.java
index 43c2abc..5c63891 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAuthenticationTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAuthenticationTest.java
@@ -38,6 +38,7 @@
import android.platform.test.annotations.AppModeFull;
import org.junit.Test;
+import org.junit.rules.TestRule;
import java.util.regex.Pattern;
@@ -61,6 +62,11 @@
Helper.enableAutofillService(getContext(), SERVICE_NAME);
}
+ @Override
+ public TestRule getMainTestRule() {
+ return InlineUiBot.annotateRule(super.getMainTestRule());
+ }
+
@Test
public void testDatasetAuthTwoFields() throws Exception {
datasetAuthTwoFields(/* cancelFirstAttempt */ false);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineFillEventHistoryTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineFillEventHistoryTest.java
index feba57c..595b7ea 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineFillEventHistoryTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineFillEventHistoryTest.java
@@ -39,6 +39,7 @@
import android.support.test.uiautomator.UiObject2;
import org.junit.Test;
+import org.junit.rules.TestRule;
import java.util.List;
@@ -62,6 +63,11 @@
Helper.enableAutofillService(getContext(), SERVICE_NAME);
}
+ @Override
+ public TestRule getMainTestRule() {
+ return InlineUiBot.annotateRule(super.getMainTestRule());
+ }
+
@Test
public void testOneDatasetAndSave() throws Exception {
enableService();
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineFilteringTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineFilteringTest.java
index e9675b1..c761d02 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineFilteringTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineFilteringTest.java
@@ -26,6 +26,7 @@
import android.autofillservice.cts.Helper;
import org.junit.Test;
+import org.junit.rules.TestRule;
// TODO: Move any tests needed from here into DatasetFilteringInlineTest.
/**
@@ -45,6 +46,11 @@
Helper.enableAutofillService(getContext(), SERVICE_NAME);
}
+ @Override
+ public TestRule getMainTestRule() {
+ return InlineUiBot.annotateRule(super.getMainTestRule());
+ }
+
@Test
public void testFiltering_filtersByPrefix() throws Exception {
enableService();
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java
index eff7b97..6aff0d5 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java
@@ -48,6 +48,7 @@
import com.android.cts.mockime.MockImeSession;
import org.junit.Test;
+import org.junit.rules.TestRule;
public class InlineLoginActivityTest extends LoginActivityCommonTestCase {
@@ -67,6 +68,11 @@
return true;
}
+ @Override
+ public TestRule getMainTestRule() {
+ return InlineUiBot.annotateRule(super.getMainTestRule());
+ }
+
@Test
public void testAutofill_disjointDatasets() throws Exception {
// Set service.
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineSimpleSaveActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineSimpleSaveActivityTest.java
index c2b5515..42f4f16 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineSimpleSaveActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineSimpleSaveActivityTest.java
@@ -36,6 +36,7 @@
import androidx.annotation.NonNull;
import org.junit.Test;
+import org.junit.rules.TestRule;
public class InlineSimpleSaveActivityTest
extends AutoFillServiceTestCase.AutoActivityLaunch<SimpleSaveActivity> {
@@ -63,6 +64,11 @@
};
}
+ @Override
+ public TestRule getMainTestRule() {
+ return InlineUiBot.annotateRule(super.getMainTestRule());
+ }
+
@Test
public void testAutofillSave() throws Exception {
// Set service.
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineUiBot.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineUiBot.java
index ca8e473..af53383 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineUiBot.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineUiBot.java
@@ -21,14 +21,19 @@
import static android.autofillservice.cts.Timeouts.UI_TIMEOUT;
import android.autofillservice.cts.UiBot;
+import android.content.pm.PackageManager;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.BySelector;
import android.support.test.uiautomator.Direction;
import android.support.test.uiautomator.UiObject2;
+import com.android.compatibility.common.util.RequiredFeatureRule;
import com.android.compatibility.common.util.Timeout;
import com.android.cts.mockime.MockIme;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TestRule;
+
/**
* UiBot for the inline suggestion.
*/
@@ -39,6 +44,9 @@
private static final BySelector SUGGESTION_STRIP_SELECTOR = By.desc(SUGGESTION_STRIP_DESC);
+ private static final RequiredFeatureRule REQUIRES_IME_RULE = new RequiredFeatureRule(
+ PackageManager.FEATURE_INPUT_METHODS);
+
public InlineUiBot() {
this(UI_TIMEOUT);
}
@@ -47,6 +55,10 @@
super(defaultTimeout);
}
+ public static RuleChain annotateRule(TestRule rule) {
+ return RuleChain.outerRule(REQUIRES_IME_RULE).around(rule);
+ }
+
@Override
public void assertNoDatasets() throws Exception {
assertNoDatasetsEver();
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineWebViewActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineWebViewActivityTest.java
index d5f0503..63cf648 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineWebViewActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineWebViewActivityTest.java
@@ -40,6 +40,7 @@
import android.view.ViewStructure.HtmlInfo;
import org.junit.Test;
+import org.junit.rules.TestRule;
public class InlineWebViewActivityTest extends AbstractWebViewTestCase<WebViewActivity> {
@@ -77,6 +78,11 @@
return true;
}
+ @Override
+ public TestRule getMainTestRule() {
+ return InlineUiBot.annotateRule(super.getMainTestRule());
+ }
+
@Test
public void testAutofillNoDatasets() throws Exception {
// Set service.
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java b/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java
index e3566b9..d0aa669 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java
@@ -102,7 +102,7 @@
public void testSameSurface() {
final SurfaceControl.Builder b = new SurfaceControl.Builder();
final SurfaceControl sc = b.setName("CTS").build();
- SurfaceControl copy = new SurfaceControl(sc);
+ SurfaceControl copy = new SurfaceControl(sc, "SurfaceControlTest.testSameSurface");
assertTrue(copy.isSameSurface(sc));
sc.release();
copy.release();
diff --git a/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java b/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java
index 343f4f0..4b765ab 100644
--- a/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java
+++ b/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java
@@ -83,7 +83,7 @@
}
final List<Object[]> exhaustiveArgsList = Arrays.asList(new Object[][]{
// Audio - CodecMime, bit-rate, sample rate, channel count
- {MediaFormat.MIMETYPE_AUDIO_AAC, 64000, 8000, 1, -1},
+ {MediaFormat.MIMETYPE_AUDIO_AAC, 64000, 48000, 1, -1},
{MediaFormat.MIMETYPE_AUDIO_AAC, 128000, 48000, 2, -1},
// Video - CodecMime, bit-rate, height, width, frame-rate
diff --git a/tests/tests/content/HelloWorldApp/AndroidManifest.xml b/tests/tests/content/HelloWorldApp/AndroidManifest.xml
index f7c6c23..f195701 100644
--- a/tests/tests/content/HelloWorldApp/AndroidManifest.xml
+++ b/tests/tests/content/HelloWorldApp/AndroidManifest.xml
@@ -4,6 +4,7 @@
<application
android:allowBackup="true"
+ android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
diff --git a/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
index 34ca9a4..8f42f79 100644
--- a/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
+++ b/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
@@ -107,6 +107,7 @@
private static final int UNKNOWN_DETECTION_METHOD = 4;
private static final int FILTERED_UNKNOWN_DETECTION_METHOD = 0;
private static final int CARRIER_CONFIG_CHANGED_BROADCAST_TIMEOUT = 5000;
+ private static final int DELAY_FOR_ADMIN_UIDS_MILLIS = 2000;
private static final Executor INLINE_EXECUTOR = x -> x.run();
@@ -268,7 +269,8 @@
// CS does not trigger NetworkCallback#onCapabilitiesChanged as changing the
// administratorUids is not a publicly visible change. In lieu of a better signal to
// detministically wait for, use Thread#sleep here.
- Thread.sleep(500);
+ // TODO(b/157949581): replace this Thread#sleep with a deterministic signal
+ Thread.sleep(DELAY_FOR_ADMIN_UIDS_MILLIS);
final TestConnectivityDiagnosticsCallback connDiagsCallback =
createAndRegisterConnectivityDiagnosticsCallback(CELLULAR_NETWORK_REQUEST);
diff --git a/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java b/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
index 1466cb8..37a448b 100644
--- a/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
+++ b/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
@@ -30,7 +30,9 @@
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
+import android.content.res.Resources;
import android.platform.test.annotations.SecurityTest;
+import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiScrollable;
import android.support.test.uiautomator.UiSelector;
@@ -53,6 +55,7 @@
private Context mContext;
private UiDevice mUiDevice;
+ private String mAllowButtonText = null;
@Before
public void setContextAndUiDevice() {
@@ -100,8 +103,15 @@
}
protected void clickAllowButton() throws Exception {
- mUiDevice.findObject(new UiSelector().resourceId(
- "com.android.permissioncontroller:id/permission_allow_button")).click();
+ if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+ if (mAllowButtonText == null) {
+ mAllowButtonText = getPermissionControllerString("grant_dialog_button_allow");
+ }
+ mUiDevice.findObject(By.text(mAllowButtonText)).click();
+ } else {
+ mUiDevice.findObject(By.res(
+ "com.android.permissioncontroller:id/permission_allow_button")).click();
+ }
}
private void grantPermissionViaUi() throws Throwable {
@@ -174,6 +184,15 @@
}
}
+ private String getPermissionControllerString(String res)
+ throws PackageManager.NameNotFoundException {
+ Resources permissionControllerResources = mContext.createPackageContext(
+ mContext.getPackageManager().getPermissionControllerPackageName(), 0)
+ .getResources();
+ return permissionControllerResources.getString(permissionControllerResources
+ .getIdentifier(res, "string", "com.android.permissioncontroller"));
+ }
+
private interface ThrowingRunnable {
void run() throws Throwable;
}
diff --git a/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt b/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt
index f4f97f71..5cd5c4f 100644
--- a/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt
@@ -21,10 +21,6 @@
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
-import android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE
-import android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE
-import android.content.pm.PackageManager.MATCH_SYSTEM_ONLY
-import android.content.pm.ResolveInfo
import android.content.res.Resources
import android.provider.Settings
import android.support.test.uiautomator.By
@@ -58,7 +54,7 @@
protected val uiDevice: UiDevice = UiDevice.getInstance(instrumentation)
protected val packageManager: PackageManager = context.packageManager
private val mPermissionControllerResources: Resources = context.createPackageContext(
- getPermissionControllerPackageName(), 0).resources
+ context.packageManager.permissionControllerPackageName, 0).resources
@get:Rule
val activityRule = ActivityTestRule(StartForFutureActivity::class.java, false, false)
@@ -98,23 +94,6 @@
mPermissionControllerResources.getString(mPermissionControllerResources
.getIdentifier(res, "string", "com.android.permissioncontroller"))
- private fun getPermissionControllerPackageName(): String {
- val intent = Intent("android.intent.action.MANAGE_PERMISSIONS")
- intent.addCategory(Intent.CATEGORY_DEFAULT)
- val packageManager: PackageManager = context.getPackageManager()
- val matches: List<ResolveInfo> = packageManager.queryIntentActivities(intent,
- MATCH_SYSTEM_ONLY or MATCH_DIRECT_BOOT_AWARE or MATCH_DIRECT_BOOT_UNAWARE)
- return if (matches.size == 1) {
- val resolveInfo: ResolveInfo = matches[0]
- if (!resolveInfo.activityInfo.applicationInfo.isPrivilegedApp()) {
- throw RuntimeException("The permissions manager must be a privileged app")
- }
- matches[0].activityInfo.packageName
- } else {
- throw RuntimeException("There must be exactly one permissions manager; found $matches")
- }
- }
-
protected fun installPackage(
apkPath: String,
reinstall: Boolean = false,
diff --git a/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java b/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
index 60cac6a..00ddc34 100644
--- a/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
+++ b/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
@@ -255,6 +255,10 @@
requestRole(ROLE_NAME);
findDontAskAgainCheck().click();
clickButtonAndWaitForResult(true);
+ // Wait for the RequestRoleActivity inside the test app to be removed from our task so that
+ // when the test app is force stopped, our task isn't force finished and our
+ // WaitForResultActivity can survive.
+ Thread.sleep(5000);
clearPackageData(APP_PACKAGE_NAME);
// Wait for the don't ask again to be forgotten.
@@ -285,6 +289,10 @@
requestRole(ROLE_NAME);
findDontAskAgainCheck().click();
clickButtonAndWaitForResult(true);
+ // Wait for the RequestRoleActivity inside the test app to be removed from our task so that
+ // when the test app is uninstalled, our task isn't force finished and our
+ // WaitForResultActivity can survive.
+ Thread.sleep(5000);
uninstallPackage(APP_PACKAGE_NAME);
// Wait for the don't ask again to be forgotten.
diff --git a/tests/tests/telecom/src/android/telecom/cts/BackgroundCallAudioTest.java b/tests/tests/telecom/src/android/telecom/cts/BackgroundCallAudioTest.java
index 1bd1b27..dc26f6d 100644
--- a/tests/tests/telecom/src/android/telecom/cts/BackgroundCallAudioTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/BackgroundCallAudioTest.java
@@ -95,6 +95,37 @@
verifySimulateRingAndUserPickup(call, connection);
}
+ public void testHoldAfterAudioProcessingFromCallScreening() throws Exception {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+
+ setupIncomingCallWithCallScreening();
+
+ final MockConnection connection = verifyConnectionForIncomingCall();
+
+ if (!mInCallCallbacks.lock.tryAcquire(TestUtils.WAIT_FOR_CALL_ADDED_TIMEOUT_S,
+ TimeUnit.SECONDS)) {
+ fail("No call added to InCallService.");
+ }
+
+ Call call = mInCallCallbacks.getService().getLastCall();
+ assertCallState(call, Call.STATE_AUDIO_PROCESSING);
+ assertConnectionState(connection, Connection.STATE_ACTIVE);
+
+ AudioManager audioManager = mContext.getSystemService(AudioManager.class);
+ if (doesAudioManagerSupportCallScreening) {
+ assertAudioMode(audioManager, MODE_CALL_SCREENING);
+ }
+
+ verifySimulateRingAndUserPickup(call, connection);
+
+ call.hold();
+ assertCallState(call, Call.STATE_HOLDING);
+ call.unhold();
+ assertCallState(call, Call.STATE_ACTIVE);
+ }
+
public void testAudioProcessingFromCallScreeningDisallow() throws Exception {
if (!mShouldTestTelecom) {
return;