Merge "Snap for 6686656 from 9a494349a1068af58c81a6613777153a7ac596d1 to sdk-release" into sdk-release
diff --git a/apps/CameraITS/tests/scene1/test_dng_noise_model.py b/apps/CameraITS/tests/scene1/test_dng_noise_model.py
index 98efd4e..8afc41b 100644
--- a/apps/CameraITS/tests/scene1/test_dng_noise_model.py
+++ b/apps/CameraITS/tests/scene1/test_dng_noise_model.py
@@ -57,8 +57,10 @@
sens_min, _ = props['android.sensor.info.sensitivityRange']
sens_max_ana = props['android.sensor.maxAnalogSensitivity']
sens_step = (sens_max_ana - sens_min) / NUM_STEPS
- s_ae, e_ae, _, _, f_dist = cam.do_3a(get_results=True)
+ s_ae, e_ae, _, _, _ = cam.do_3a(get_results=True, do_af=False)
s_e_prod = s_ae * e_ae
+ # Focus at zero to intentionally blur the scene as much as possible.
+ f_dist = 0.0
sensitivities = range(sens_min, sens_max_ana+1, sens_step)
var_expected = [[], [], [], []]
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index fccfde0..381193a 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -272,6 +272,10 @@
android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
</activity>
+ <!-- Support service to ensure HID Device Test succeeds on
+ devices with full screen pairing dialogs (ex. Android TV -->
+ <service android:name=".bluetooth.FocusLossPreventionService" />
+
<!--
CTS Verifier Bluetooth Hid Host Test Screen
test category : bt_device_communication
diff --git a/apps/CtsVerifier/res/xml/uicc_transaction_event_aid_list.xml b/apps/CtsVerifier/res/xml/uicc_transaction_event_aid_list.xml
index 91042d1..1f3f5e3 100644
--- a/apps/CtsVerifier/res/xml/uicc_transaction_event_aid_list.xml
+++ b/apps/CtsVerifier/res/xml/uicc_transaction_event_aid_list.xml
@@ -1,6 +1,6 @@
<offhost-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/UiccTransactionEventService"
- android:requireDeviceUnlock="false">
+ android:requireDeviceUnlock="false" android:secureElementName="SIM">
<aid-group
android:category="other"
android:description="@string/UiccTransactionEventService" >
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/FocusLossPreventionService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/FocusLossPreventionService.java
new file mode 100644
index 0000000..a232bb7
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/FocusLossPreventionService.java
@@ -0,0 +1,60 @@
+package com.android.cts.verifier.bluetooth;
+
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.os.IBinder;
+import com.android.cts.verifier.R;
+
+public class FocusLossPreventionService extends Service {
+
+ public static final String TAG = "FocusLossPreventionService";
+
+ private static final String NOTIFICATION_CHANNEL_ID = "ctsVerifier/" + TAG;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ Context context = getApplicationContext();
+ String title = getResources().getString(R.string.app_name);
+ String channelId = "default";
+
+ NotificationManager notificationManager = getSystemService(NotificationManager.class);
+
+ if (notificationManager != null) {
+ notificationManager.createNotificationChannel(
+ new NotificationChannel(
+ NOTIFICATION_CHANNEL_ID,
+ NOTIFICATION_CHANNEL_ID,
+ NotificationManager.IMPORTANCE_DEFAULT));
+
+ Notification notification =
+ new Notification.Builder(context, NOTIFICATION_CHANNEL_ID)
+ .setContentTitle(title)
+ .setSmallIcon(android.R.drawable.stat_sys_data_bluetooth)
+ .build();
+
+ startForeground(1, notification);
+ }
+
+ return START_NOT_STICKY;
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopForeground(true /* removeNotification */);
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/HidDeviceActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/HidDeviceActivity.java
index 24a097d..c5cffc9 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/HidDeviceActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/HidDeviceActivity.java
@@ -23,6 +23,7 @@
import android.bluetooth.BluetoothHidDeviceAppSdpSettings;
import android.bluetooth.BluetoothProfile;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
@@ -161,12 +162,22 @@
testReportError();
}
});
+
+ if (isAndroidTv()) {
+ startForegroundService(new Intent(getApplication(),
+ FocusLossPreventionService.class));
+ }
}
@Override
protected void onDestroy() {
super.onDestroy();
unregister();
+
+ if (isAndroidTv()) {
+ stopService(new Intent(getApplication(),
+ FocusLossPreventionService.class));
+ }
}
private boolean register() {
@@ -289,4 +300,10 @@
}
return (byte) (c - 'a' + 0x04);
}
+
+ private boolean isAndroidTv() {
+ final PackageManager pm = getApplicationContext().getPackageManager();
+ return pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
+ || pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
+ }
}
diff --git a/build/compatibility_test_suite.mk b/build/compatibility_test_suite.mk
index 01a2fff..c980951 100644
--- a/build/compatibility_test_suite.mk
+++ b/build/compatibility_test_suite.mk
@@ -42,7 +42,7 @@
LOCAL_JAVA_RESOURCE_FILES += $(suite_info_prop)
# Add the base libraries
-LOCAL_JAVA_LIBRARIES += tradefed loganalysis hosttestlib compatibility-host-util
+LOCAL_JAVA_LIBRARIES += tradefed loganalysis compatibility-host-util
LOCAL_MODULE_TAGS := optional
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTest.java
index 6f3c07c..45de5dc 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTest.java
@@ -129,7 +129,7 @@
}
private int createSecondaryUserAsProfileOwner() throws Exception {
- final int userId = createUser();
+ final int userId = createUserAndWaitStart();
installAppAsUser(INTENT_RECEIVER_APK, userId);
installAppAsUser(DEVICE_ADMIN_APK, userId);
setProfileOwnerOrFail(DEVICE_ADMIN_COMPONENT_FLATTENED, userId);
diff --git a/hostsidetests/hdmicec/app/Android.bp b/hostsidetests/hdmicec/app/Android.bp
index 6d713d3..ed41e1a 100644
--- a/hostsidetests/hdmicec/app/Android.bp
+++ b/hostsidetests/hdmicec/app/Android.bp
@@ -21,4 +21,5 @@
"guava",
"androidx.test.runner",
],
+ min_sdk_version: "28",
}
diff --git a/hostsidetests/hdmicec/app/AndroidManifest.xml b/hostsidetests/hdmicec/app/AndroidManifest.xml
index bb19e50..9be9136 100644
--- a/hostsidetests/hdmicec/app/AndroidManifest.xml
+++ b/hostsidetests/hdmicec/app/AndroidManifest.xml
@@ -38,4 +38,6 @@
</activity>
</application>
+ <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28" />
+
</manifest>
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/LogHelper.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/LogHelper.java
new file mode 100644
index 0000000..a7692f38
--- /dev/null
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/LogHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2019 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.hdmicec.cts;
+
+import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assume.assumeTrue;
+
+import com.android.tradefed.device.ITestDevice;
+
+import com.google.common.collect.Lists;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.concurrent.TimeUnit;
+
+/** Helper class to get for device logcat. */
+public final class LogHelper {
+
+ private static final int WAIT_TIME = 10;
+
+ /**
+ * The tag of the SadConfigurationReaderTest launched by the APK.
+ */
+ private static final String SAD_READER = "SadConfigurationReaderTest";
+
+ private static final String SAD_CONFIGURATION_MARKER = "Supported Audio Formats";
+
+ private static String getLog(ITestDevice device, String tag) throws Exception {
+ TimeUnit.SECONDS.sleep(WAIT_TIME);
+ String logs = device.executeAdbCommand("logcat", "-v", "brief", "-d", tag + ":I", "*:S");
+ // Search for string.
+ String testString = "";
+ Scanner in = new Scanner(logs);
+ while (in.hasNextLine()) {
+ String line = in.nextLine();
+ if (line.startsWith("I/" + tag)) {
+ testString = line.split(":")[1].trim();
+ }
+ }
+ device.executeAdbCommand("logcat", "-c");
+ return testString;
+ }
+
+ public static void assertLog(ITestDevice device, String tag, String ...expectedOutput)
+ throws Exception {
+ String testString = getLog(device, tag);
+ List<String> expectedOutputs = new ArrayList<>(Arrays.asList(expectedOutput));
+ assertThat(testString).isIn(expectedOutputs);
+ }
+
+ public static void assertLogDoesNotContain(ITestDevice device, String tag,
+ String expectedOutput) throws Exception {
+ String testString = getLog(device, tag);
+ assertThat(testString).doesNotContain(expectedOutput);
+ }
+
+ public static List<Integer> getSupportedAudioFormats(ITestDevice device) throws Exception {
+ TimeUnit.SECONDS.sleep(WAIT_TIME);
+ String logs =
+ device.executeAdbCommand("logcat", "-v", "brief", "-d", SAD_READER + ":I", "*:S");
+ // Search for string.
+ String testString = "";
+ Scanner in = new Scanner(logs);
+ List<Integer> mSupportedAudioFormats = null;
+ while (in.hasNextLine()) {
+ String line = in.nextLine();
+ if (line.startsWith("I/" + SAD_READER)) {
+ testString = line.split(":")[1].trim();
+ if (testString.equals(SAD_CONFIGURATION_MARKER)) {
+ List<String> mFormatsLine =
+ Arrays.asList(in.nextLine().split(":")[1].trim().split(", "));
+ List<String> mCodecSADsLine =
+ Arrays.asList(in.nextLine().split(":")[1].trim().split(", "));
+ mSupportedAudioFormats =
+ Lists.transform(mFormatsLine, fl -> Integer.parseInt(fl));
+ }
+ }
+ }
+ device.executeAdbCommand("logcat", "-c");
+ assumeTrue(testString.equals(SAD_CONFIGURATION_MARKER));
+ return mSupportedAudioFormats;
+ }
+}
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecInvalidMessagesTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecInvalidMessagesTest.java
index f7644f2..a77573e 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecInvalidMessagesTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecInvalidMessagesTest.java
@@ -24,6 +24,7 @@
import android.hdmicec.cts.CecOperand;
import android.hdmicec.cts.HdmiCecClientWrapper;
import android.hdmicec.cts.HdmiCecConstants;
+import android.hdmicec.cts.LogHelper;
import android.hdmicec.cts.LogicalAddress;
import android.hdmicec.cts.RequiredPropertyRule;
import android.hdmicec.cts.RequiredFeatureRule;
@@ -37,9 +38,6 @@
import org.junit.rules.RuleChain;
import org.junit.runner.RunWith;
-import java.util.Scanner;
-import java.util.concurrent.TimeUnit;
-
/** HDMI CEC test to verify that device ignores invalid messages (Section 12) */
@RunWith(DeviceJUnit4ClassRunner.class)
public final class HdmiCecInvalidMessagesTest extends BaseHostJUnit4Test {
@@ -60,8 +58,6 @@
/** The command to clear the main activity. */
private static final String CLEAR_COMMAND = String.format("pm clear %s", PACKAGE);
- private static final int WAIT_TIME = 10;
-
public HdmiCecClientWrapper hdmiCecClient = new HdmiCecClientWrapper(AUDIO_DEVICE);
@Rule
@@ -104,24 +100,6 @@
}
}
- private void logShouldNotContain(String expectedOut) throws Exception {
- ITestDevice device = getDevice();
- TimeUnit.SECONDS.sleep(WAIT_TIME);
- String logs = device.executeAdbCommand("logcat", "-v", "brief", "-d", CLASS + ":I", "*:S");
- // Search for string.
- String testString = "";
- Scanner in = new Scanner(logs);
- while (in.hasNextLine()) {
- String line = in.nextLine();
- if(line.startsWith("I/" + CLASS)) {
- testString = line.split(":")[1].trim();
- break;
- }
- }
- device.executeAdbCommand("logcat", "-c");
- assertThat(testString).doesNotContain(expectedOut);
- }
-
/**
* Test 12-1
* Tests that the device ignores every broadcast only message that is received as
@@ -352,6 +330,6 @@
LogicalAddress.BROADCAST,
HdmiCecConstants.CEC_CONTROL_UP,
false);
- logShouldNotContain("Short press KEYCODE_DPAD_UP");
+ LogHelper.assertLogDoesNotContain(getDevice(), CLASS, "Short press KEYCODE_DPAD_UP");
}
}
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecRemoteControlPassThroughTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecRemoteControlPassThroughTest.java
index e7e0be4..d01b506 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecRemoteControlPassThroughTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecRemoteControlPassThroughTest.java
@@ -16,10 +16,9 @@
package android.hdmicec.cts.audio;
-import static com.google.common.truth.Truth.assertThat;
-
import android.hdmicec.cts.HdmiCecClientWrapper;
import android.hdmicec.cts.HdmiCecConstants;
+import android.hdmicec.cts.LogHelper;
import android.hdmicec.cts.LogicalAddress;
import android.hdmicec.cts.RequiredPropertyRule;
import android.hdmicec.cts.RequiredFeatureRule;
@@ -33,9 +32,6 @@
import org.junit.runner.RunWith;
import org.junit.Test;
-import java.util.Scanner;
-import java.util.concurrent.TimeUnit;
-
@RunWith(DeviceJUnit4ClassRunner.class)
public final class HdmiCecRemoteControlPassThroughTest extends BaseHostJUnit4Test {
@@ -52,8 +48,6 @@
/** The command to clear the main activity. */
private static final String CLEAR_COMMAND = String.format("pm clear %s", PACKAGE);
- private static final int WAIT_TIME = 10;
-
public HdmiCecClientWrapper hdmiCecClient = new HdmiCecClientWrapper(LogicalAddress.AUDIO_SYSTEM);
@Rule
@@ -67,24 +61,6 @@
LogicalAddress.AUDIO_SYSTEM.getDeviceType()))
.around(hdmiCecClient);
- private void lookForLog(String expectedOut) throws Exception {
- ITestDevice device = getDevice();
- TimeUnit.SECONDS.sleep(WAIT_TIME);
- String logs = device.executeAdbCommand("logcat", "-v", "brief", "-d", CLASS + ":I", "*:S");
- // Search for string.
- String testString = "";
- Scanner in = new Scanner(logs);
- while (in.hasNextLine()) {
- String line = in.nextLine();
- if(line.startsWith("I/" + CLASS)) {
- testString = line.split(":")[1].trim();
- break;
- }
- }
- device.executeAdbCommand("logcat", "-c");
- assertThat(testString).isEqualTo(expectedOut);
- }
-
/**
* Test 11.2.13-1
* Tests that the device responds correctly to a <User Control Pressed> message followed
@@ -101,22 +77,22 @@
device.executeShellCommand(START_COMMAND);
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_UP, false);
- lookForLog("Short press KEYCODE_DPAD_UP");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_DPAD_UP");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_DOWN, false);
- lookForLog("Short press KEYCODE_DPAD_DOWN");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_DPAD_DOWN");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_LEFT, false);
- lookForLog("Short press KEYCODE_DPAD_LEFT");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_DPAD_LEFT");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_RIGHT, false);
- lookForLog("Short press KEYCODE_DPAD_RIGHT");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_DPAD_RIGHT");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_SELECT, false);
- lookForLog("Short press KEYCODE_DPAD_CENTER");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_DPAD_CENTER");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_BACK, false);
- lookForLog("Short press KEYCODE_BACK");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_BACK");
}
/**
@@ -135,22 +111,22 @@
device.executeShellCommand(START_COMMAND);
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_UP, true);
- lookForLog("Long press KEYCODE_DPAD_UP");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_UP");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_DOWN, true);
- lookForLog("Long press KEYCODE_DPAD_DOWN");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_DOWN");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_LEFT, true);
- lookForLog("Long press KEYCODE_DPAD_LEFT");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_LEFT");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_RIGHT, true);
- lookForLog("Long press KEYCODE_DPAD_RIGHT");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_RIGHT");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_SELECT, true);
- lookForLog("Long press KEYCODE_DPAD_CENTER");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_CENTER");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_BACK, true);
- lookForLog("Long press KEYCODE_BACK");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_BACK");
}
/**
@@ -169,22 +145,22 @@
device.executeShellCommand(START_COMMAND);
hdmiCecClient.sendUserControlPress(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_UP, true);
- lookForLog("Long press KEYCODE_DPAD_UP");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_UP");
hdmiCecClient.sendUserControlPress(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_DOWN, true);
- lookForLog("Long press KEYCODE_DPAD_DOWN");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_DOWN");
hdmiCecClient.sendUserControlPress(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_LEFT, true);
- lookForLog("Long press KEYCODE_DPAD_LEFT");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_LEFT");
hdmiCecClient.sendUserControlPress(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_RIGHT, true);
- lookForLog("Long press KEYCODE_DPAD_RIGHT");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_RIGHT");
hdmiCecClient.sendUserControlPress(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_SELECT, true);
- lookForLog("Long press KEYCODE_DPAD_CENTER");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_CENTER");
hdmiCecClient.sendUserControlPress(LogicalAddress.TV, LogicalAddress.AUDIO_SYSTEM,
HdmiCecConstants.CEC_CONTROL_BACK, true);
- lookForLog("Long press KEYCODE_BACK");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_BACK");
}
/**
@@ -205,26 +181,26 @@
hdmiCecClient.sendUserControlInterruptedPressAndHold(LogicalAddress.TV,
LogicalAddress.AUDIO_SYSTEM, HdmiCecConstants.CEC_CONTROL_UP,
HdmiCecConstants.CEC_CONTROL_BACK, true);
- lookForLog("Long press KEYCODE_DPAD_UP");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_UP");
hdmiCecClient.sendUserControlInterruptedPressAndHold(LogicalAddress.TV,
LogicalAddress.AUDIO_SYSTEM, HdmiCecConstants.CEC_CONTROL_DOWN,
HdmiCecConstants.CEC_CONTROL_UP, true);
- lookForLog("Long press KEYCODE_DPAD_DOWN");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_DOWN");
hdmiCecClient.sendUserControlInterruptedPressAndHold(LogicalAddress.TV,
LogicalAddress.AUDIO_SYSTEM, HdmiCecConstants.CEC_CONTROL_LEFT,
HdmiCecConstants.CEC_CONTROL_DOWN, true);
- lookForLog("Long press KEYCODE_DPAD_LEFT");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_LEFT");
hdmiCecClient.sendUserControlInterruptedPressAndHold(LogicalAddress.TV,
LogicalAddress.AUDIO_SYSTEM, HdmiCecConstants.CEC_CONTROL_RIGHT,
HdmiCecConstants.CEC_CONTROL_LEFT, true);
- lookForLog("Long press KEYCODE_DPAD_RIGHT");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_RIGHT");
hdmiCecClient.sendUserControlInterruptedPressAndHold(LogicalAddress.TV,
LogicalAddress.AUDIO_SYSTEM, HdmiCecConstants.CEC_CONTROL_SELECT,
HdmiCecConstants.CEC_CONTROL_RIGHT, true);
- lookForLog("Long press KEYCODE_DPAD_CENTER");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_CENTER");
hdmiCecClient.sendUserControlInterruptedPressAndHold(LogicalAddress.TV,
LogicalAddress.AUDIO_SYSTEM, HdmiCecConstants.CEC_CONTROL_BACK,
HdmiCecConstants.CEC_CONTROL_SELECT, true);
- lookForLog("Long press KEYCODE_BACK");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_BACK");
}
}
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecSystemAudioModeTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecSystemAudioModeTest.java
index 4cb7b97..0138a9a 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecSystemAudioModeTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecSystemAudioModeTest.java
@@ -18,15 +18,14 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
-import static org.junit.Assume.assumeTrue;
-import com.google.common.collect.Lists;
import com.google.common.collect.Range;
import android.hdmicec.cts.CecMessage;
import android.hdmicec.cts.CecOperand;
import android.hdmicec.cts.HdmiCecClientWrapper;
import android.hdmicec.cts.HdmiCecConstants;
+import android.hdmicec.cts.LogHelper;
import android.hdmicec.cts.LogicalAddress;
import android.hdmicec.cts.RequiredPropertyRule;
import android.hdmicec.cts.RequiredFeatureRule;
@@ -42,10 +41,7 @@
import org.junit.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
-import java.util.Scanner;
-import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@@ -59,9 +55,6 @@
/** The class name of the main activity in the APK. */
private static final String CLASS = "HdmiCecAudioManager";
- /** The tag of the SadConfigurationReaderTest launched by the APK. */
- private static final String SAD_READER = "SadConfigurationReaderTest";
-
/** The command to launch the main activity. */
private static final String START_COMMAND = String.format(
"am start -n %s/%s.%s -a ", PACKAGE, PACKAGE, CLASS);
@@ -69,13 +62,11 @@
/** The command to clear the main activity. */
private static final String CLEAR_COMMAND = String.format("pm clear %s", PACKAGE);
- private static final int WAIT_TIME = 10;
private static final LogicalAddress AUDIO_DEVICE = LogicalAddress.AUDIO_SYSTEM;
private static final int ON = 0x1;
private static final int OFF = 0x0;
private static final int MAX_AUDIO_FORMATS = 4;
private static final int MAX_VALID_AUDIO_FORMATS = 2;
- private static final String SAD_CONFIGURATION_MARKER = "Supported Audio Formats";
private List<Integer> mSupportedAudioFormats = null;
@@ -92,51 +83,6 @@
AUDIO_DEVICE.getDeviceType()))
.around(hdmiCecClient);
- private void lookForLogFromHdmiCecAudioManager(String expectedOut) throws Exception {
- ITestDevice device = getDevice();
- TimeUnit.SECONDS.sleep(WAIT_TIME);
- String logs = device.executeAdbCommand("logcat", "-v", "brief", "-d", CLASS + ":I", "*:S");
- // Search for string.
- String testString = "";
- Scanner in = new Scanner(logs);
- while (in.hasNextLine()) {
- String line = in.nextLine();
- if(line.startsWith("I/" + CLASS)) {
- testString = line.split(":")[1].trim();
- break;
- }
- }
- device.executeAdbCommand("logcat", "-c");
- assertThat(testString).isEqualTo(expectedOut);
- }
-
- private void lookForLogFromSadConfigurationReaderTest(String expectedOut) throws Exception {
- ITestDevice device = getDevice();
- TimeUnit.SECONDS.sleep(WAIT_TIME);
- String logs =
- device.executeAdbCommand("logcat", "-v", "brief", "-d", SAD_READER + ":I", "*:S");
- // Search for string.
- String testString = "";
- Scanner in = new Scanner(logs);
- while (in.hasNextLine()) {
- String line = in.nextLine();
- if (line.startsWith("I/" + SAD_READER)) {
- testString = line.split(":")[1].trim();
- if (testString.equals(SAD_CONFIGURATION_MARKER)) {
- List<String> mFormatsLine =
- Arrays.asList(in.nextLine().split(":")[1].trim().split(", "));
- List<String> mCodecSADsLine =
- Arrays.asList(in.nextLine().split(":")[1].trim().split(", "));
- mSupportedAudioFormats =
- Lists.transform(mFormatsLine, fl -> Integer.parseInt(fl));
- break;
- }
- }
- }
- device.executeAdbCommand("logcat", "-c");
- assumeTrue(testString.equals(expectedOut));
- }
-
private String getRequestSadFormatsParams(boolean sendValidFormats) throws Exception {
ITestDevice device = getDevice();
// Clear activity
@@ -145,7 +91,7 @@
device.executeAdbCommand("logcat", "-c");
// Start the APK and wait for it to complete.
device.executeShellCommand(START_COMMAND + "android.hdmicec.app.GET_SUPPORTED_SAD_FORMATS");
- lookForLogFromSadConfigurationReaderTest(SAD_CONFIGURATION_MARKER);
+ mSupportedAudioFormats = LogHelper.getSupportedAudioFormats(getDevice());
// Create a list of all the audio format codes according to CEA-861-D. Remove the supported
// audio format codes from it, to get the unsupported audio format codes.
@@ -202,7 +148,7 @@
// Start the APK and wait for it to complete.
device.executeShellCommand(START_COMMAND + "android.hdmicec.app.REPORT_VOLUME");
try {
- lookForLogFromHdmiCecAudioManager("Device muted.");
+ LogHelper.assertLog(getDevice(), CLASS, "Device muted.");
return true;
} catch(Exception e) {
return false;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecPowerStatusTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecPowerStatusTest.java
index b1bfb1e..2d8d3ac 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecPowerStatusTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecPowerStatusTest.java
@@ -43,8 +43,11 @@
private static final int ON = 0x0;
private static final int OFF = 0x1;
+ private static final int IN_TRANSITION_TO_STANDBY = 0x3;
+ private static final int SLEEP_TIMESTEP_SECONDS = 1;
private static final int WAIT_TIME = 5;
+ private static final int MAX_SLEEP_TIME = 8;
public HdmiCecClientWrapper hdmiCecClient = new HdmiCecClientWrapper(LogicalAddress.PLAYBACK_1);
@@ -90,10 +93,16 @@
device.executeShellCommand("input keyevent KEYCODE_HOME");
device.executeShellCommand("input keyevent KEYCODE_SLEEP");
TimeUnit.SECONDS.sleep(WAIT_TIME);
- hdmiCecClient.sendCecMessage(LogicalAddress.TV, CecOperand.GIVE_POWER_STATUS);
- String message = hdmiCecClient.checkExpectedOutput(LogicalAddress.TV,
- CecOperand.REPORT_POWER_STATUS);
- assertThat(CecMessage.getParams(message)).isEqualTo(OFF);
+ int waitTimeSeconds = WAIT_TIME;
+ int powerStatus;
+ do {
+ TimeUnit.SECONDS.sleep(SLEEP_TIMESTEP_SECONDS);
+ waitTimeSeconds += SLEEP_TIMESTEP_SECONDS;
+ hdmiCecClient.sendCecMessage(LogicalAddress.TV, CecOperand.GIVE_POWER_STATUS);
+ powerStatus = CecMessage.getParams(hdmiCecClient.checkExpectedOutput(
+ LogicalAddress.TV, CecOperand.REPORT_POWER_STATUS));
+ } while (powerStatus == IN_TRANSITION_TO_STANDBY && waitTimeSeconds <= MAX_SLEEP_TIME);
+ assertThat(powerStatus).isEqualTo(OFF);
} finally {
/* Wake up the device */
device.executeShellCommand("input keyevent KEYCODE_WAKEUP");
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRemoteControlPassThroughTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRemoteControlPassThroughTest.java
index 160e80f5..b0d927d 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRemoteControlPassThroughTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRemoteControlPassThroughTest.java
@@ -16,10 +16,9 @@
package android.hdmicec.cts.playback;
-import static com.google.common.truth.Truth.assertThat;
-
import android.hdmicec.cts.HdmiCecClientWrapper;
import android.hdmicec.cts.HdmiCecConstants;
+import android.hdmicec.cts.LogHelper;
import android.hdmicec.cts.LogicalAddress;
import android.hdmicec.cts.RequiredPropertyRule;
import android.hdmicec.cts.RequiredFeatureRule;
@@ -33,9 +32,6 @@
import org.junit.runner.RunWith;
import org.junit.Test;
-import java.util.Scanner;
-import java.util.concurrent.TimeUnit;
-
/** HDMI CEC test to check if the device reports power status correctly (Section 11.2.13) */
@RunWith(DeviceJUnit4ClassRunner.class)
public final class HdmiCecRemoteControlPassThroughTest extends BaseHostJUnit4Test {
@@ -58,8 +54,6 @@
*/
private static final String CLEAR_COMMAND = String.format("pm clear %s", PACKAGE);
- private static final int WAIT_TIME = 10;
-
public HdmiCecClientWrapper hdmiCecClient = new HdmiCecClientWrapper(LogicalAddress.PLAYBACK_1);
@Rule
@@ -73,34 +67,6 @@
LogicalAddress.PLAYBACK_1.getDeviceType()))
.around(hdmiCecClient);
- private void lookForLog(String expectedOut) throws Exception {
- String testString = getKeyPressLog();
- assertThat(testString).isEqualTo(expectedOut);
- }
-
- private void lookForLog(String expectedOut1, String expectedOut2) throws Exception {
- String testString = getKeyPressLog();
- assertThat(testString).isAnyOf(expectedOut1, expectedOut2);
- }
-
- private String getKeyPressLog() throws Exception {
- ITestDevice device = getDevice();
- TimeUnit.SECONDS.sleep(WAIT_TIME);
- String logs = device.executeAdbCommand("logcat", "-v", "brief", "-d", CLASS + ":I", "*:S");
- // Search for string.
- String testString = "";
- Scanner in = new Scanner(logs);
- while (in.hasNextLine()) {
- String line = in.nextLine();
- if(line.startsWith("I/" + CLASS)) {
- testString = line.split(":")[1].trim();
- break;
- }
- }
- device.executeAdbCommand("logcat", "-c");
- return testString;
- }
-
/**
* Test 11.2.13-1
* Tests that the device responds correctly to a <USER_CONTROL_PRESSED> message followed
@@ -117,22 +83,23 @@
device.executeShellCommand(START_COMMAND);
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_UP, false);
- lookForLog("Short press KEYCODE_DPAD_UP");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_DPAD_UP");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_DOWN, false);
- lookForLog("Short press KEYCODE_DPAD_DOWN");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_DPAD_DOWN");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_LEFT, false);
- lookForLog("Short press KEYCODE_DPAD_LEFT");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_DPAD_LEFT");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_RIGHT, false);
- lookForLog("Short press KEYCODE_DPAD_RIGHT");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_DPAD_RIGHT");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_SELECT, false);
- lookForLog("Short press KEYCODE_DPAD_CENTER", "Short press KEYCODE_ENTER");
+ LogHelper.assertLog(getDevice(), CLASS,
+ "Short press KEYCODE_DPAD_CENTER", "Short press KEYCODE_ENTER");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_BACK, false);
- lookForLog("Short press KEYCODE_BACK");
+ LogHelper.assertLog(getDevice(), CLASS, "Short press KEYCODE_BACK");
}
/**
@@ -151,21 +118,22 @@
device.executeShellCommand(START_COMMAND);
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_UP, true);
- lookForLog("Long press KEYCODE_DPAD_UP");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_UP");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_DOWN, true);
- lookForLog("Long press KEYCODE_DPAD_DOWN");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_DOWN");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_LEFT, true);
- lookForLog("Long press KEYCODE_DPAD_LEFT");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_LEFT");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_RIGHT, true);
- lookForLog("Long press KEYCODE_DPAD_RIGHT");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_DPAD_RIGHT");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_SELECT, true);
- lookForLog("Long press KEYCODE_DPAD_CENTER", "Long press KEYCODE_ENTER");
+ LogHelper.assertLog(getDevice(), CLASS,
+ "Long press KEYCODE_DPAD_CENTER", "Long press KEYCODE_ENTER");
hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, LogicalAddress.PLAYBACK_1,
HdmiCecConstants.CEC_CONTROL_BACK, true);
- lookForLog("Long press KEYCODE_BACK");
+ LogHelper.assertLog(getDevice(), CLASS, "Long press KEYCODE_BACK");
}
}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkCallbackTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkCallbackTest.java
index aa59959..eedccb6 100644
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkCallbackTest.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkCallbackTest.java
@@ -29,6 +29,7 @@
import android.net.Network;
import android.net.NetworkCapabilities;
+import android.util.Log;
import org.junit.After;
import org.junit.Before;
@@ -141,15 +142,16 @@
}
public void expectBlockedStatusCallback(Network expectedNetwork, boolean expectBlocked) {
- expectCallback(CallbackState.BLOCKED_STATUS, expectedNetwork,
- expectBlocked);
+ expectCallback(CallbackState.BLOCKED_STATUS, expectedNetwork, expectBlocked);
}
- public void waitBlockedStatusCallback(Network expectedNetwork, boolean expectBlocked) {
+ public void expectBlockedStatusCallbackEventually(Network expectedNetwork,
+ boolean expectBlocked) {
final long deadline = System.currentTimeMillis() + TEST_CALLBACK_TIMEOUT_MS;
do {
final CallbackInfo cb = nextCallback((int) (deadline - System.currentTimeMillis()));
- if (cb.state == CallbackState.BLOCKED_STATUS) {
+ if (cb.state == CallbackState.BLOCKED_STATUS
+ && cb.network.equals(expectedNetwork)) {
assertEquals(expectBlocked, cb.arg);
return;
}
@@ -157,17 +159,23 @@
fail("Didn't receive onBlockedStatusChanged()");
}
- public void expectCapabilitiesCallback(Network expectedNetwork, boolean hasCapability,
- int capability) {
- final CallbackInfo cb = nextCallback(TEST_CALLBACK_TIMEOUT_MS);
- final NetworkCapabilities cap = (NetworkCapabilities) cb.arg;
- assertEquals(expectedNetwork, cb.network);
- assertEquals(CallbackState.CAPABILITIES, cb.state);
- if (hasCapability != cap.hasCapability(capability)) {
- fail("NetworkCapabilities callback "
- + (hasCapability ? "missing expected" : "has unexpected")
- + " capability. " + cb);
- }
+ public void expectCapabilitiesCallbackEventually(Network expectedNetwork, boolean hasCap,
+ int cap) {
+ final long deadline = System.currentTimeMillis() + TEST_CALLBACK_TIMEOUT_MS;
+ do {
+ final CallbackInfo cb = nextCallback((int) (deadline - System.currentTimeMillis()));
+ if (cb.state != CallbackState.CAPABILITIES
+ || !expectedNetwork.equals(cb.network)
+ || (hasCap != ((NetworkCapabilities) cb.arg).hasCapability(cap))) {
+ Log.i("NetworkCallbackTest#expectCapabilitiesCallback",
+ "Ignoring non-matching callback : " + cb);
+ continue;
+ }
+ // Found a match, return
+ return;
+ } while (System.currentTimeMillis() <= deadline);
+ fail("Didn't receive the expected callback to onCapabilitiesChanged(). Check the "
+ + "log for a list of received callbacks, if any.");
}
}
@@ -194,8 +202,8 @@
// callback to ensure wifi is connected before the test and store the default network.
mNetwork = mTestNetworkCallback.expectAvailableCallbackAndGetNetwork();
// Check that the network is metered.
- mTestNetworkCallback.expectCapabilitiesCallback(mNetwork, false /* hasCapability */,
- NET_CAPABILITY_NOT_METERED);
+ mTestNetworkCallback.expectCapabilitiesCallbackEventually(mNetwork,
+ false /* hasCapability */, NET_CAPABILITY_NOT_METERED);
mTestNetworkCallback.expectBlockedStatusCallback(mNetwork, false);
}
@@ -215,28 +223,28 @@
// Enable restrict background
setRestrictBackground(true);
assertBackgroundNetworkAccess(false);
- mTestNetworkCallback.waitBlockedStatusCallback(mNetwork, true);
+ mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, true);
// Add to whitelist
addRestrictBackgroundWhitelist(mUid);
assertBackgroundNetworkAccess(true);
- mTestNetworkCallback.waitBlockedStatusCallback(mNetwork, false);
+ mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, false);
// Remove from whitelist
removeRestrictBackgroundWhitelist(mUid);
assertBackgroundNetworkAccess(false);
- mTestNetworkCallback.waitBlockedStatusCallback(mNetwork, true);
+ mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, true);
} finally {
mMeterednessConfiguration.resetNetworkMeteredness();
}
// Set to non-metered network
mMeterednessConfiguration.configureNetworkMeteredness(false);
- mTestNetworkCallback.expectCapabilitiesCallback(mNetwork, true /* hasCapability */,
- NET_CAPABILITY_NOT_METERED);
+ mTestNetworkCallback.expectCapabilitiesCallbackEventually(mNetwork,
+ true /* hasCapability */, NET_CAPABILITY_NOT_METERED);
try {
assertBackgroundNetworkAccess(true);
- mTestNetworkCallback.waitBlockedStatusCallback(mNetwork, false);
+ mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, false);
// Disable restrict background, should not trigger callback
setRestrictBackground(false);
@@ -253,30 +261,30 @@
// Enable Power Saver
setBatterySaverMode(true);
assertBackgroundNetworkAccess(false);
- mTestNetworkCallback.waitBlockedStatusCallback(mNetwork, true);
+ mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, true);
// Disable Power Saver
setBatterySaverMode(false);
assertBackgroundNetworkAccess(true);
- mTestNetworkCallback.waitBlockedStatusCallback(mNetwork, false);
+ mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, false);
} finally {
mMeterednessConfiguration.resetNetworkMeteredness();
}
// Set to non-metered network
mMeterednessConfiguration.configureNetworkMeteredness(false);
- mTestNetworkCallback.expectCapabilitiesCallback(mNetwork, true /* hasCapability */,
- NET_CAPABILITY_NOT_METERED);
+ mTestNetworkCallback.expectCapabilitiesCallbackEventually(mNetwork,
+ true /* hasCapability */, NET_CAPABILITY_NOT_METERED);
try {
// Enable Power Saver
setBatterySaverMode(true);
assertBackgroundNetworkAccess(false);
- mTestNetworkCallback.waitBlockedStatusCallback(mNetwork, true);
+ mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, true);
// Disable Power Saver
setBatterySaverMode(false);
assertBackgroundNetworkAccess(true);
- mTestNetworkCallback.waitBlockedStatusCallback(mNetwork, false);
+ mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, false);
} finally {
mMeterednessConfiguration.resetNetworkMeteredness();
}
diff --git a/test_defs.sh b/test_defs.sh
index cc92685..1d9cf57 100644
--- a/test_defs.sh
+++ b/test_defs.sh
@@ -21,7 +21,6 @@
COMMON_JARS="
ddmlib-prebuilt\
- hosttestlib\
tradefed"
checkFile() {
diff --git a/tests/JobScheduler/AndroidTest.xml b/tests/JobScheduler/AndroidTest.xml
index 6c487be..d81ead1 100644
--- a/tests/JobScheduler/AndroidTest.xml
+++ b/tests/JobScheduler/AndroidTest.xml
@@ -19,6 +19,7 @@
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
<option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="token" value="SIM_CARD" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsJobSchedulerTestCases.apk" />
diff --git a/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java b/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java
index 4b765ab..d0e4030 100644
--- a/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java
+++ b/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java
@@ -163,8 +163,10 @@
// TODO (b/151429828)
//{MediaFormat.MIMETYPE_VIDEO_HEVC, 128000, 176, 144, 15},
{MediaFormat.MIMETYPE_VIDEO_HEVC, 1500000, 352, 288, 30},
- {MediaFormat.MIMETYPE_VIDEO_HEVC, 3000000, 640, 360, 30},
- {MediaFormat.MIMETYPE_VIDEO_HEVC, 6000000, 960, 540, 30},
+ // TODO (b/152576008) - Limit HEVC Encoder test to 512x512
+ {MediaFormat.MIMETYPE_VIDEO_HEVC, 3000000, 512, 512, 30},
+ //{MediaFormat.MIMETYPE_VIDEO_HEVC, 3000000, 640, 360, 30},
+ //{MediaFormat.MIMETYPE_VIDEO_HEVC, 6000000, 960, 540, 30},
{MediaFormat.MIMETYPE_VIDEO_HEVC, 10000000, 1280, 720, 33},
{MediaFormat.MIMETYPE_VIDEO_HEVC, 12000000, 2048, 1080, 30},
{MediaFormat.MIMETYPE_VIDEO_HEVC, 20000000, 2048, 1080, 60},
diff --git a/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java b/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
index 29a9a04..cf3139b 100644
--- a/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
+++ b/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
@@ -253,10 +253,6 @@
assertEquals(TelephonyManager.UPDATE_AVAILABLE_NETWORKS_SUCCESS, value);
}
- private static void assertUpdateAvailableNetworkInvalidArguments(int value) {
- assertEquals(TelephonyManager.UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS, value);
- }
-
private static void assertUpdateAvailableNetworkNoOpportunisticSubAvailable(int value) {
assertEquals(
TelephonyManager.UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE, value);
@@ -313,8 +309,6 @@
List<AvailableNetworkInfo> availableNetworkInfos = new ArrayList<AvailableNetworkInfo>();
Consumer<Integer> callbackSuccess =
CarrierApiTest::assertUpdateAvailableNetworkSuccess;
- Consumer<Integer> callbackFailure =
- CarrierApiTest::assertUpdateAvailableNetworkInvalidArguments;
Consumer<Integer> callbackNoOpportunisticSubAvailable =
CarrierApiTest::assertUpdateAvailableNetworkNoOpportunisticSubAvailable;
Consumer<Integer> setOpCallbackSuccess = CarrierApiTest::assertSetOpportunisticSubSuccess;
@@ -336,7 +330,7 @@
// clear all the operations at the end of test.
availableNetworkInfos.clear();
mTelephonyManager.updateAvailableNetworks(availableNetworkInfos,
- AsyncTask.SERIAL_EXECUTOR, callbackFailure);
+ AsyncTask.SERIAL_EXECUTOR, callbackNoOpportunisticSubAvailable);
}
} else {
// This is case of DSDS phone, one active opportunistic subscription and one
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
index bfc3be2..ec44400 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
@@ -247,7 +247,7 @@
AnimatedVectorDrawableTest.waitForAVDStop(callback, MAX_TIMEOUT_MS);
// Check that the AVD with empty AnimatorSet has finished
callback.assertEnded(true);
- callback.assertAVDRuntime(0, TimeUnit.MILLISECONDS.toNanos(300));
+ callback.assertAVDRuntime(0, TimeUnit.MILLISECONDS.toNanos(900));
}
// Does a fuzzy comparison between two images.
diff --git a/tests/tests/identity/src/android/security/identity/cts/ProvisioningTest.java b/tests/tests/identity/src/android/security/identity/cts/ProvisioningTest.java
index 0085a7c..519e915 100644
--- a/tests/tests/identity/src/android/security/identity/cts/ProvisioningTest.java
+++ b/tests/tests/identity/src/android/security/identity/cts/ProvisioningTest.java
@@ -107,12 +107,26 @@
static Collection<X509Certificate> createCredential(IdentityCredentialStore store,
String credentialName) throws IdentityCredentialException {
- return createCredentialWithChallenge(store, credentialName, "SomeChallenge".getBytes());
+ return createCredentialWithChallengeAndAcpId(store, credentialName, "SomeChallenge".getBytes(), 0);
+ }
+
+ static Collection<X509Certificate> createCredentialWithAcpId(IdentityCredentialStore store,
+ String credentialName,
+ int accessControlProfileId) throws IdentityCredentialException {
+ return createCredentialWithChallengeAndAcpId(store, credentialName, "SomeChallenge".getBytes(),
+ accessControlProfileId);
}
static Collection<X509Certificate> createCredentialWithChallenge(IdentityCredentialStore store,
String credentialName,
byte[] challenge) throws IdentityCredentialException {
+ return createCredentialWithChallengeAndAcpId(store, credentialName, challenge, 0);
+ }
+
+ static Collection<X509Certificate> createCredentialWithChallengeAndAcpId(IdentityCredentialStore store,
+ String credentialName,
+ byte[] challenge,
+ int id) throws IdentityCredentialException {
WritableIdentityCredential wc = null;
wc = store.createCredential(credentialName, "org.iso.18013-5.2019.mdl");
@@ -120,16 +134,16 @@
wc.getCredentialKeyCertificateChain(challenge);
// TODO: inspect cert-chain
- // Profile 0 (no authentication)
+ // Profile X (no authentication)
AccessControlProfile noAuthProfile =
- new AccessControlProfile.Builder(new AccessControlProfileId(0))
+ new AccessControlProfile.Builder(new AccessControlProfileId(id))
.setUserAuthenticationRequired(false)
.build();
byte[] drivingPrivileges = getExampleDrivingPrivilegesCbor();
Collection<AccessControlProfileId> idsNoAuth = new ArrayList<AccessControlProfileId>();
- idsNoAuth.add(new AccessControlProfileId(0));
+ idsNoAuth.add(new AccessControlProfileId(id));
Collection<AccessControlProfileId> idsNoAcp = new ArrayList<AccessControlProfileId>();
String mdlNs = "org.iso.18013-5.2019";
PersonalizationData personalizationData =
@@ -170,7 +184,7 @@
+ " 'org.iso.18013-5.2019.mdl',\n"
+ " [\n"
+ " {\n"
- + " 'id' : 0\n"
+ + " 'id' : " + id + "\n"
+ " }\n"
+ " ],\n"
+ " {\n"
@@ -178,57 +192,57 @@
+ " {\n"
+ " 'name' : 'First name',\n"
+ " 'value' : 'Alan',\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'Last name',\n"
+ " 'value' : 'Turing',\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'Home address',\n"
+ " 'value' : 'Maida Vale, London, England',\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'Birth date',\n"
+ " 'value' : '19120623',\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'Cryptanalyst',\n"
+ " 'value' : true,\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'Portrait image',\n"
+ " 'value' : [0x01, 0x02],\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'Height',\n"
+ " 'value' : 180,\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'Neg Item',\n"
+ " 'value' : -42,\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'Int Two Bytes',\n"
+ " 'value' : 257,\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'Int Four Bytes',\n"
+ " 'value' : 65537,\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'Int Eight Bytes',\n"
+ " 'value' : 4294967297,\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'driving_privileges',\n"
@@ -238,7 +252,7 @@
+ " 'vehicle_category_code' : 'TODO'\n"
+ " }\n"
+ " ],\n"
- + " 'accessControlProfiles' : [0]\n"
+ + " 'accessControlProfiles' : [" + id + "]\n"
+ " },\n"
+ " {\n"
+ " 'name' : 'No Access',\n"
@@ -912,4 +926,94 @@
}
}
+ @Test
+ public void testProvisionAcpIdNotStartingAtZero() throws
+ IdentityCredentialException, CborException {
+ assumeTrue("IC HAL is not implemented", Util.isHalImplemented());
+
+ Context appContext = InstrumentationRegistry.getTargetContext();
+ IdentityCredentialStore store = IdentityCredentialStore.getInstance(appContext);
+
+ store.deleteCredentialByName("test");
+ Collection<X509Certificate> certChain = createCredentialWithAcpId(store, "test", 1);
+
+ IdentityCredential credential = store.getCredentialByName("test",
+ IdentityCredentialStore.CIPHERSUITE_ECDHE_HKDF_ECDSA_WITH_AES_256_GCM_SHA256);
+
+ // Check that the read-back certChain matches the created one.
+ Collection<X509Certificate> readBackCertChain =
+ credential.getCredentialKeyCertificateChain();
+ assertEquals(certChain.size(), readBackCertChain.size());
+ Iterator<X509Certificate> it = readBackCertChain.iterator();
+ for (X509Certificate expectedCert : certChain) {
+ X509Certificate readBackCert = it.next();
+ assertEquals(expectedCert, readBackCert);
+ }
+
+ Map<String, Collection<String>> entriesToRequest = new LinkedHashMap<>();
+ entriesToRequest.put("org.iso.18013-5.2019",
+ Arrays.asList("First name",
+ "Last name",
+ "Home address",
+ "Birth date",
+ "Cryptanalyst",
+ "Portrait image",
+ "Height",
+ "Neg Item",
+ "Int Two Bytes",
+ "Int Eight Bytes",
+ "Int Four Bytes",
+ "driving_privileges"));
+ ResultData rd = credential.getEntries(
+ Util.createItemsRequest(entriesToRequest, null),
+ entriesToRequest,
+ null,
+ null);
+
+ Collection<String> resultNamespaces = rd.getNamespaces();
+ assertEquals(resultNamespaces.size(), 1);
+ assertEquals("org.iso.18013-5.2019", resultNamespaces.iterator().next());
+ assertEquals(12, rd.getEntryNames("org.iso.18013-5.2019").size());
+
+ String ns = "org.iso.18013-5.2019";
+ assertEquals("Alan", Util.getStringEntry(rd, ns, "First name"));
+ assertEquals("Turing", Util.getStringEntry(rd, ns, "Last name"));
+ assertEquals("Maida Vale, London, England", Util.getStringEntry(rd, ns, "Home address"));
+ assertEquals("19120623", Util.getStringEntry(rd, ns, "Birth date"));
+ assertEquals(true, Util.getBooleanEntry(rd, ns, "Cryptanalyst"));
+ assertArrayEquals(new byte[]{0x01, 0x02},
+ Util.getBytestringEntry(rd, ns, "Portrait image"));
+ assertEquals(180, Util.getIntegerEntry(rd, ns, "Height"));
+ assertEquals(-42, Util.getIntegerEntry(rd, ns, "Neg Item"));
+ assertEquals(0x101, Util.getIntegerEntry(rd, ns, "Int Two Bytes"));
+ assertEquals(0x10001, Util.getIntegerEntry(rd, ns, "Int Four Bytes"));
+ assertEquals(0x100000001L, Util.getIntegerEntry(rd, ns, "Int Eight Bytes"));
+ byte[] drivingPrivileges = getExampleDrivingPrivilegesCbor();
+ assertArrayEquals(drivingPrivileges, rd.getEntry(ns, "driving_privileges"));
+
+ assertEquals("{\n"
+ + " 'org.iso.18013-5.2019' : {\n"
+ + " 'Height' : 180,\n"
+ + " 'Neg Item' : -42,\n"
+ + " 'Last name' : 'Turing',\n"
+ + " 'Birth date' : '19120623',\n"
+ + " 'First name' : 'Alan',\n"
+ + " 'Cryptanalyst' : true,\n"
+ + " 'Home address' : 'Maida Vale, London, England',\n"
+ + " 'Int Two Bytes' : 257,\n"
+ + " 'Int Four Bytes' : 65537,\n"
+ + " 'Portrait image' : [0x01, 0x02],\n"
+ + " 'Int Eight Bytes' : 4294967297,\n"
+ + " 'driving_privileges' : [\n"
+ + " {\n"
+ + " 'value' : 42,\n"
+ + " 'vehicle_category_code' : 'TODO'\n"
+ + " }\n"
+ + " ]\n"
+ + " }\n"
+ + "}", Util.cborPrettyPrint(Util.canonicalizeCbor(rd.getAuthenticatedData())));
+
+ store.deleteCredentialByName("test");
+ }
+
}
diff --git a/tests/tests/nativemidi/java/android/nativemidi/cts/NativeMidiEchoTest.java b/tests/tests/nativemidi/java/android/nativemidi/cts/NativeMidiEchoTest.java
index 707730d..960149b 100644
--- a/tests/tests/nativemidi/java/android/nativemidi/cts/NativeMidiEchoTest.java
+++ b/tests/tests/nativemidi/java/android/nativemidi/cts/NativeMidiEchoTest.java
@@ -76,6 +76,16 @@
return pm.hasSystemFeature(PackageManager.FEATURE_MIDI);
}
+ public static boolean hasLibAMidi() {
+ try {
+ System.loadLibrary("amidi");
+ } catch (UnsatisfiedLinkError ex) {
+ Log.e(TAG, "libamidi.so not found.");
+ return false;
+ }
+ return true;
+ }
+
private byte[] generateRandomMessage(int len) {
byte[] buffer = new byte[len];
for(int index = 0; index < len; index++) {
@@ -131,7 +141,6 @@
}
protected void setUpEchoServer() throws Exception {
- Log.i(TAG, "++ setUpEchoServer()");
MidiDeviceInfo echoInfo = MidiEchoTestService.findEchoDevice(mContext);
// Open device.
@@ -161,7 +170,6 @@
}
protected void tearDownEchoServer() throws IOException {
- Log.i(TAG, "++ tearDownEchoServer()");
// Query echo service directly to see if it is getting status updates.
MidiEchoTestService echoService = MidiEchoTestService.getInstance();
@@ -209,10 +217,10 @@
//
@Before
public void setUp() throws Exception {
- Log.i(TAG, "++ setUp() mContext:" + mContext);
if (!hasMidiSupport()) {
return; // Not supported so don't test it.
}
+
mMidiManager = (MidiManager)mContext.getSystemService(Context.MIDI_SERVICE);
Assert.assertNotNull("Could not get the MidiManger.", mMidiManager);
@@ -221,34 +229,37 @@
@After
public void tearDown() throws Exception {
+ if (!hasMidiSupport()) {
+ return; // Not supported so don't test it.
+ }
tearDownEchoServer();
- Log.i(TAG, "++ tearDown()");
mMidiManager = null;
}
@Test
public void test_A_MidiManager() throws Exception {
- Log.i(TAG, "++++ test_A_MidiManager() this:" + System.identityHashCode(this));
-
if (!hasMidiSupport()) {
- return; // Nothing to test
+ return;
}
-
Assert.assertNotNull("MidiManager not supported.", mMidiManager);
// There should be at least one device for the Echo server.
MidiDeviceInfo[] infos = mMidiManager.getDevices();
Assert.assertNotNull("device list was null", infos);
Assert.assertTrue("device list was empty", infos.length >= 1);
+ }
- Log.i(TAG, "++++ test_A_MidiManager() - DONE");
+ @Test
+ public void test_AA_LibAMidiExists() throws Exception {
+ if (!hasMidiSupport()) {
+ return;
+ }
+ Assert.assertTrue("libamidi.so not found.", hasLibAMidi());
}
@Test
public void test_B_SendData() throws Exception {
- Log.i(TAG, "++++ test_B_SendData() this:" + System.identityHashCode(this));
-
if (!hasMidiSupport()) {
return; // Nothing to test
}
@@ -262,20 +273,15 @@
long timestamp = 0x0123765489ABFEDCL;
writeMidi(mTestContext, buffer, 0, buffer.length);
- Assert.assertTrue("Didn't get 1 send", getNumBytesSent(mTestContext) == buffer.length);
Assert.assertEquals("Didn't get right number of bytes sent",
buffer.length, getNumBytesSent(mTestContext));
-
- Log.i(TAG, "++++ test_B_SendData() - DONE");
}
@Test
public void test_C_EchoSmallMessage() throws Exception {
- Log.i(TAG, "++++ test_C_EchoSmallMessage() this:" + System.identityHashCode(this));
if (!hasMidiSupport()) {
- return; // nothing to test
+ return;
}
-
final byte[] buffer = {
(byte) 0x93, 0x47, 0x52
};
@@ -294,23 +300,19 @@
NativeMidiMessage message = getReceivedMessageAt(mTestContext, 0);
compareMessages(buffer, timestamp, message);
-
- Log.i(TAG, "++++ test_C_EchoSmallMessage() - DONE");
}
@Test
public void test_D_EchoNMessages() throws Exception {
- Log.i(TAG, "++++ test_D_EchoNMessages() this:" + System.identityHashCode(this));
if (!hasMidiSupport()) {
- return; // nothing to test
+ return;
}
-
int numMessages = 100;
byte[][] buffers = new byte[numMessages][];
long timestamps[] = new long[numMessages];
generateRandomBufers(buffers, timestamps, numMessages);
- for(int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
+ for (int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
writeMidiWithTimestamp(mTestContext, buffers[msgIndex], 0, buffers[msgIndex].length,
timestamps[msgIndex]);
}
@@ -324,29 +326,25 @@
numMessages, getNumReceivedMessages(mTestContext));
// correct data & order?
- for(int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
+ for (int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
NativeMidiMessage message = getReceivedMessageAt(mTestContext, msgIndex);
compareMessages(buffers[msgIndex], timestamps[msgIndex], message);
}
-
- Log.i(TAG, "++++ test_D_EchoNMessages() - DONE");
}
@Test
public void test_E_FlushMessages() throws Exception {
- Log.i(TAG, "++++ test_E_FlushMessages() this:" + System.identityHashCode(this));
if (!hasMidiSupport()) {
- return; // nothing to test
+ return;
}
-
int numMessages = 7;
byte[][] buffers = new byte[numMessages][];
long timestamps[] = new long[numMessages];
generateRandomBufers(buffers, timestamps, numMessages);
- for(int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
+ for (int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
writeMidiWithTimestamp(mTestContext, buffers[msgIndex], 0, buffers[msgIndex].length,
- timestamps[msgIndex]);
+ timestamps[msgIndex]);
}
// Wait for message to pass through echo service.
@@ -361,21 +359,17 @@
numMessages, getNumReceivedMessages(mTestContext));
// correct data & order?
- for(int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
+ for (int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
NativeMidiMessage message = getReceivedMessageAt(mTestContext, msgIndex);
compareMessages(buffers[msgIndex], timestamps[msgIndex], message);
}
-
- Log.i(TAG, "++++ test_E_FlushMessages() - DONE");
}
@Test
public void test_F_HugeMessage() throws Exception {
- Log.i(TAG, "++++ test_F_HugeMessage() this:" + System.identityHashCode(this));
if (!hasMidiSupport()) {
- return; // nothing to test
+ return;
}
-
// Arbitrarily large message.
int hugeMessageLen = 1024 * 10;
byte[] buffer = generateRandomMessage(hugeMessageLen);
@@ -386,8 +380,6 @@
buffer = generateRandomMessage(kindaHugeMessageLen);
result = writeMidi(mTestContext, buffer, 0, buffer.length);
Assert.assertEquals("Kinda big write failed.", kindaHugeMessageLen, result);
-
- Log.i(TAG, "++++ test_F_HugeMessage() - DONE");
}
/**
@@ -396,14 +388,12 @@
*/
@Test
public void test_G_NativeEchoTime() throws Exception {
- Log.i(TAG, "++++ test_G_NativeEchoTime() this:" + System.identityHashCode(this));
if (!hasMidiSupport()) {
- return; // nothing to test
+ return;
}
-
final int numMessages = 10;
final long maxLatencyNanos = 15 * NANOS_PER_MSEC; // generally < 3 msec on N6
- byte[] buffer = { (byte) 0x93, 0, 64 };
+ byte[] buffer = {(byte) 0x93, 0, 64};
// Send multiple messages in a burst.
for (int index = 0; index < numMessages; index++) {
@@ -424,28 +414,25 @@
// If this test fails then there may be a problem with the thread scheduler
// or there may be kernel activity that is blocking execution at the user level.
Assert.assertTrue("MIDI round trip latency index:" + msgIndex
- + " too large, " + elapsedNanos
- + " nanoseconds " +
- "timestamp:" + message.timestamp + " received:" + message.timeReceived,
+ + " too large, " + elapsedNanos
+ + " nanoseconds " +
+ "timestamp:" + message.timestamp +
+ " received:" + message.timeReceived,
(elapsedNanos < maxLatencyNanos));
}
-
- Log.i(TAG, "++++ test_G_NativeEchoTime() - DONE");
}
@Test
public void test_H_EchoNMessages_PureNative() throws Exception {
- Log.i(TAG, "++++ test_H_EchoNMessages_PureNative() this:" + System.identityHashCode(this));
if (!hasMidiSupport()) {
- return; // nothing to test
+ return;
}
-
int numMessages = 2;
byte[][] buffers = new byte[numMessages][];
long timestamps[] = new long[numMessages];
generateRandomBufers(buffers, timestamps, numMessages);
- for(int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
+ for (int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
writeMidiWithTimestamp(mTestContext, buffers[msgIndex], 0, buffers[msgIndex].length,
timestamps[msgIndex]);
}
@@ -456,8 +443,6 @@
int result = matchNativeMessages(mTestContext);
Assert.assertEquals("Native Compare Test Failed", result, 0);
-
- Log.i(TAG, "++++ test_H_EchoNMessages_PureNative() - DONE");
}
/**
@@ -466,15 +451,12 @@
*/
@Test
public void test_I_NativeEchoTime_PureNative() throws Exception {
- Log.i(TAG, "++++ test_I_NativeEchoTime_PureNative() this:"
- + System.identityHashCode(this));
if (!hasMidiSupport()) {
- return; // nothing to test
+ return;
}
-
final int numMessages = 10;
final long maxLatencyNanos = 15 * NANOS_PER_MSEC; // generally < 3 msec on N6
- byte[] buffer = { (byte) 0x93, 0, 64 };
+ byte[] buffer = {(byte) 0x93, 0, 64};
// Send multiple messages in a burst.
for (int index = 0; index < numMessages; index++) {
@@ -490,8 +472,6 @@
int result = checkNativeLatency(mTestContext, maxLatencyNanos);
Assert.assertEquals("failed pure native latency test.", 0, result);
-
- Log.i(TAG, "++++ test_I_NativeEchoTime_PureNative() - DONE");
}
// Native Routines
diff --git a/tests/tests/net/Android.bp b/tests/tests/net/Android.bp
index c90ca5e..926b45c 100644
--- a/tests/tests/net/Android.bp
+++ b/tests/tests/net/Android.bp
@@ -83,7 +83,7 @@
min_sdk_version: "29",
target_sdk_version: "29",
test_suites: [
- "device-tests",
+ "general-tests",
"mts",
],
test_config_template: "AndroidTestTemplate.xml",
diff --git a/tests/tests/net/AndroidTestTemplate.xml b/tests/tests/net/AndroidTestTemplate.xml
index 1f75da1..4e937512 100644
--- a/tests/tests/net/AndroidTestTemplate.xml
+++ b/tests/tests/net/AndroidTestTemplate.xml
@@ -19,6 +19,8 @@
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
<option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+
+ <option name="config-descriptor:metadata" key="mainline-param" value="CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk" />
<option name="not-shardable" value="true" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/tests/net/TEST_MAPPING b/tests/tests/net/TEST_MAPPING
index e2a9c75..3162e22 100644
--- a/tests/tests/net/TEST_MAPPING
+++ b/tests/tests/net/TEST_MAPPING
@@ -9,5 +9,15 @@
}
]
}
+ ],
+ "mainline-presubmit": [
+ {
+ "name": "CtsNetTestCasesLatestSdk[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk]",
+ "options": [
+ {
+ "exclude-annotation": "com.android.testutils.SkipPresubmit"
+ }
+ ]
+ }
]
}
diff --git a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
index 3880664..0050318 100644
--- a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -55,6 +55,7 @@
import android.app.Instrumentation;
import android.app.PendingIntent;
import android.app.UiAutomation;
+import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -122,6 +123,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
@@ -152,6 +154,9 @@
// device could have only one interface: data, wifi.
private static final int MIN_NUM_NETWORK_TYPES = 1;
+ // Airplane Mode BroadcastReceiver Timeout
+ private static final int AIRPLANE_MODE_CHANGE_TIMEOUT_MS = 5000;
+
// Minimum supported keepalive counts for wifi and cellular.
public static final int MIN_SUPPORTED_CELLULAR_KEEPALIVE_COUNT = 1;
public static final int MIN_SUPPORTED_WIFI_KEEPALIVE_COUNT = 3;
@@ -1371,4 +1376,84 @@
}
}
}
+
+ /**
+ * Verifies that apps are allowed to call setAirplaneMode if they declare
+ * NETWORK_AIRPLANE_MODE permission in their manifests.
+ * See b/145164696.
+ */
+ @AppModeFull(reason = "NETWORK_AIRPLANE_MODE permission can't be granted to instant apps")
+ @Test
+ public void testSetAirplaneMode() throws Exception{
+ // store the current state of airplane mode
+ final boolean isAirplaneModeEnabled = isAirplaneModeEnabled();
+
+ // disable airplane mode to reach a known state
+ runShellCommand("cmd connectivity airplane-mode disable");
+
+ try {
+ // Verify we cannot set Airplane Mode without correct permission:
+ try {
+ setAndVerifyAirplaneMode(true);
+ fail("SecurityException should have been thrown when setAirplaneMode was called"
+ + "without holding permission NETWORK_AIRPLANE_MODE.");
+ } catch (SecurityException expected) {}
+
+ // disable airplane mode again to reach a known state
+ runShellCommand("cmd connectivity airplane-mode disable");
+
+ // adopt shell permission which holds NETWORK_AIRPLANE_MODE
+ mUiAutomation.adoptShellPermissionIdentity();
+
+ // Verify we can enable Airplane Mode with correct permission:
+ try {
+ setAndVerifyAirplaneMode(true);
+ } catch (SecurityException e) {
+ fail("SecurityException should not have been thrown when setAirplaneMode(true) was"
+ + "called whilst holding the NETWORK_AIRPLANE_MODE permission.");
+ }
+
+ // Verify we can disable Airplane Mode with correct permission:
+ try {
+ setAndVerifyAirplaneMode(false);
+ } catch (SecurityException e) {
+ fail("SecurityException should not have been thrown when setAirplaneMode(false) was"
+ + "called whilst holding the NETWORK_AIRPLANE_MODE permission.");
+ }
+
+ } finally {
+ // Restore the previous state of airplane mode and permissions:
+ runShellCommand("cmd connectivity airplane-mode "
+ + (isAirplaneModeEnabled ? "enable" : "disable"));
+ mUiAutomation.dropShellPermissionIdentity();
+ }
+ }
+
+ private void setAndVerifyAirplaneMode(Boolean expectedResult)
+ throws Exception {
+ final CompletableFuture<Boolean> actualResult = new CompletableFuture();
+ BroadcastReceiver receiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ // The defaultValue of getExtraBoolean should be the opposite of what is
+ // expected, thus ensuring a test failure if the extra is absent.
+ actualResult.complete(intent.getBooleanExtra("state", !expectedResult));
+ }
+ };
+ try {
+ mContext.registerReceiver(receiver,
+ new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED));
+ mCm.setAirplaneMode(expectedResult);
+ final String msg = "Setting Airplane Mode failed,";
+ assertEquals(msg, expectedResult, actualResult.get(AIRPLANE_MODE_CHANGE_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS));
+ } finally {
+ mContext.unregisterReceiver(receiver);
+ }
+ }
+
+ private static boolean isAirplaneModeEnabled() {
+ return runShellCommand("cmd connectivity airplane-mode")
+ .trim().equals("enabled");
+ }
}
diff --git a/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt b/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt
index 03b961b..c8e1fc3 100644
--- a/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt
+++ b/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt
@@ -495,8 +495,8 @@
.addTransportType(NetworkCapabilities.TRANSPORT_TEST)
.setNetworkSpecifier(StringNetworkSpecifier(name2))
.build()
- val callback1 = TestableNetworkCallback()
- val callback2 = TestableNetworkCallback()
+ val callback1 = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS)
+ val callback2 = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS)
requestNetwork(request1, callback1)
requestNetwork(request2, callback2)
@@ -505,7 +505,7 @@
.clearCapabilities()
.addTransportType(NetworkCapabilities.TRANSPORT_TEST)
.build()
- val callback = TestableNetworkCallback()
+ val callback = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS)
requestNetwork(request, callback)
// Connect the first Network
@@ -592,4 +592,50 @@
assertNull(it.uri)
}
}
+
+ @Test
+ fun testTemporarilyUnmeteredCapability() {
+ // This test will create a networks with/without NET_CAPABILITY_TEMPORARILY_NOT_METERED
+ // and check that the callback reflects the capability changes.
+ // First create a request to make sure the network is kept up
+ val request1 = NetworkRequest.Builder()
+ .clearCapabilities()
+ .addTransportType(NetworkCapabilities.TRANSPORT_TEST)
+ .build()
+ val callback1 = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS).also {
+ registerNetworkCallback(request1, it)
+ }
+ requestNetwork(request1, callback1)
+
+ // Then file the interesting request
+ val request = NetworkRequest.Builder()
+ .clearCapabilities()
+ .addTransportType(NetworkCapabilities.TRANSPORT_TEST)
+ .build()
+ val callback = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS)
+ requestNetwork(request, callback)
+
+ // Connect the network
+ createConnectedNetworkAgent().let { (agent, _) ->
+ callback.expectAvailableThenValidatedCallbacks(agent.network)
+
+ // Send TEMP_NOT_METERED and check that the callback is called appropriately.
+ val nc1 = NetworkCapabilities(agent.nc)
+ .addCapability(NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED)
+ agent.sendNetworkCapabilities(nc1)
+ callback.expectCapabilitiesThat(agent.network) {
+ it.hasCapability(NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED)
+ }
+
+ // Remove TEMP_NOT_METERED and check that the callback is called appropriately.
+ val nc2 = NetworkCapabilities(agent.nc)
+ .removeCapability(NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED)
+ agent.sendNetworkCapabilities(nc2)
+ callback.expectCapabilitiesThat(agent.network) {
+ !it.hasCapability(NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED)
+ }
+ }
+
+ // tearDown() will unregister the requests and agents
+ }
}
diff --git a/tests/tests/provider/OWNERS b/tests/tests/provider/OWNERS
index ed13f6fa..a8bd066 100644
--- a/tests/tests/provider/OWNERS
+++ b/tests/tests/provider/OWNERS
@@ -1,9 +1,9 @@
# Bug component: 1344
+nandana@google.com
+zezeozue@google.com
jsharkey@android.com
-omakoto@google.com
-yamasani@google.com
tgunn@google.com
nicksauer@google.com
nona@google.com
-nandana@google.com
-zezeozue@google.com
+omakoto@google.com
+
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_FilesTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_FilesTest.java
index 9e71c69..dbf40d1 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_FilesTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_FilesTest.java
@@ -59,6 +59,7 @@
private Context mContext;
private ContentResolver mResolver;
+ private Uri mExternalAudio;
private Uri mExternalImages;
private Uri mExternalFiles;
@@ -76,6 +77,7 @@
mResolver = mContext.getContentResolver();
Log.d(TAG, "Using volume " + mVolumeName);
+ mExternalAudio = MediaStore.Audio.Media.getContentUri(mVolumeName);
mExternalImages = MediaStore.Images.Media.getContentUri(mVolumeName);
mExternalFiles = MediaStore.Files.getContentUri(mVolumeName);
}
@@ -303,25 +305,20 @@
@Test
public void testInPlaceUpdate_mediaFileWithInvalidRelativePath() throws Exception {
final File file = new File(ProviderTestUtils.stageDownloadDir(mVolumeName),
- "test" + System.nanoTime() + ".jpg");
- ProviderTestUtils.stageFile(R.raw.scenery, file);
- Log.d(TAG, "Staged image file at " + file.getAbsolutePath());
+ "test" + System.nanoTime() + ".mp3");
+ ProviderTestUtils.stageFile(R.raw.testmp3, file);
+ Log.d(TAG, "Staged audio file at " + file.getAbsolutePath());
final ContentValues insertValues = new ContentValues();
insertValues.put(MediaColumns.DATA, file.getAbsolutePath());
- insertValues.put(MediaStore.Images.ImageColumns.DESCRIPTION, "Not a cat photo");
- final Uri uri = mResolver.insert(mExternalImages, insertValues);
- assertEquals(0, queryLong(uri, MediaStore.Images.ImageColumns.IS_PRIVATE));
- assertStringColumn(uri, MediaStore.Images.ImageColumns.DESCRIPTION, "Not a cat photo");
+ insertValues.put(MediaStore.Audio.AudioColumns.BOOKMARK, 42L);
+ final Uri uri = mResolver.insert(mExternalAudio, insertValues);
+ assertEquals(42L, queryLong(uri, MediaStore.Audio.AudioColumns.BOOKMARK));
final ContentValues updateValues = new ContentValues();
- updateValues.put(FileColumns.MEDIA_TYPE, FileColumns.MEDIA_TYPE_IMAGE);
- updateValues.put(FileColumns.MIME_TYPE, "image/jpeg");
- updateValues.put(MediaStore.Images.ImageColumns.IS_PRIVATE, 1);
- int updateRows = mResolver.update(uri, updateValues, null, null);
- assertEquals(1, updateRows);
- // Only interested in update not throwing exception. No need in checking whenever values
- // were actually updates, as it is not in the scope of this test.
+ updateValues.put(MediaStore.Audio.AudioColumns.BOOKMARK, 43L);
+ assertEquals(1, mResolver.update(uri, updateValues, null, null));
+ assertEquals(43L, queryLong(uri, MediaStore.Audio.AudioColumns.BOOKMARK));
}
private long queryLong(Uri uri, String columnName) {
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java b/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java
index b832a74..3ec048b 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java
@@ -330,7 +330,7 @@
NetworkRegistrationInfo wwanDataRegState = new NetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
- 0, 0, 0, true, null, null, "", 0, false, false, false, lteVopsSupportInfo, false);
+ 0, 0, 0, true, null, null, "", 0, false, false, false, lteVopsSupportInfo);
ServiceState ss = new ServiceState();
@@ -345,7 +345,7 @@
wwanDataRegState = new NetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
- 0, 0, 0, true, null, null, "", 0, false, false, false, lteVopsSupportInfo, false);
+ 0, 0, 0, true, null, null, "", 0, false, false, false, lteVopsSupportInfo);
ss.addNetworkRegistrationInfo(wwanDataRegState);
assertEquals(ss.getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
AccessNetworkConstants.TRANSPORT_TYPE_WWAN), wwanDataRegState);
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
index d697aab..3e6f2df 100755
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
@@ -320,6 +320,9 @@
assertFalse("[RERUN] SIM card does not provide phone number. Use a suitable SIM Card.",
TextUtils.isEmpty(mDestAddr));
+ // disable suppressing blocking.
+ TelephonyUtils.endBlockSuppression(getInstrumentation());
+
String mccmnc = mTelephonyManager.getSimOperator();
// Setting default SMS App is needed to be able to block numbers.
setDefaultSmsApp(true);
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
index 03b2e8d..a9164b6ee 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -691,6 +691,10 @@
Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
return;
}
+ if (!mTelephonyManager.isVoiceCapable()) {
+ Log.d(TAG, "Skipping test that requires config_voice_capable is true");
+ return;
+ }
TelecomManager telecomManager = getContext().getSystemService(TelecomManager.class);
PhoneAccountHandle handle =
telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL);
@@ -1974,10 +1978,6 @@
assertThat(value).isEqualTo(TelephonyManager.UPDATE_AVAILABLE_NETWORKS_SUCCESS);
}
- private static void assertUpdateAvailableNetworkInvalidArguments(int value) {
- assertThat(value).isEqualTo(TelephonyManager.UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS);
- }
-
private static void assertUpdateAvailableNetworkNoOpportunisticSub(int value) {
assertThat(value).isEqualTo(
TelephonyManager.UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE);
@@ -2067,8 +2067,6 @@
List<AvailableNetworkInfo> availableNetworkInfos = new ArrayList<AvailableNetworkInfo>();
Consumer<Integer> callbackSuccess =
TelephonyManagerTest::assertUpdateAvailableNetworkSuccess;
- Consumer<Integer> callbackFailure =
- TelephonyManagerTest::assertUpdateAvailableNetworkInvalidArguments;
Consumer<Integer> callbackNoOpSub =
TelephonyManagerTest::assertUpdateAvailableNetworkNoOpportunisticSub;
if (subscriptionInfoList == null || subscriptionInfoList.size() == 0
@@ -2086,7 +2084,7 @@
availableNetworkInfos.clear();
ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
(tm) -> tm.updateAvailableNetworks(availableNetworkInfos,
- AsyncTask.SERIAL_EXECUTOR, callbackFailure));
+ AsyncTask.SERIAL_EXECUTOR, callbackNoOpSub));
} else {
AvailableNetworkInfo availableNetworkInfo = new AvailableNetworkInfo(
subscriptionInfoList.get(0).getSubscriptionId(),
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyUtils.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyUtils.java
index 2bd8bb8..f389098 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyUtils.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyUtils.java
@@ -33,6 +33,8 @@
private static final String COMMAND_REMOVE_TEST_EMERGENCY_NUMBER =
"cmd phone emergency-number-test-mode -r ";
+ private static final String COMMAND_END_BLOCK_SUPPRESSION = "cmd phone end-block-suppression";
+
public static void addTestEmergencyNumber(Instrumentation instr, String testNumber)
throws Exception {
executeShellCommand(instr, COMMAND_ADD_TEST_EMERGENCY_NUMBER + testNumber);
@@ -43,6 +45,10 @@
executeShellCommand(instr, COMMAND_REMOVE_TEST_EMERGENCY_NUMBER + testNumber);
}
+ public static void endBlockSuppression(Instrumentation instr) throws Exception {
+ executeShellCommand(instr, COMMAND_END_BLOCK_SUPPRESSION);
+ }
+
public static boolean isSkt(TelephonyManager telephonyManager) {
return isOperator(telephonyManager, "45005");
}
diff --git a/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java b/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
index 5e2f627..f47f454 100644
--- a/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
+++ b/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
@@ -697,6 +697,7 @@
@Test
public void testRequestLatestEntitlementResult() throws Exception {
+ assumeTrue(mTM.isTetheringSupported());
// Verify that requestLatestTetheringEntitlementResult() can get entitlement
// result(TETHER_ERROR_ENTITLEMENT_UNKNOWN due to invalid downstream type) via listener.
assertEntitlementResult(listener -> mTM.requestLatestTetheringEntitlementResult(
@@ -715,6 +716,9 @@
}, false),
TETHER_ERROR_ENTITLEMENT_UNKNOWN);
+ // Do not request TETHERING_WIFI entitlement result if TETHERING_WIFI is not available.
+ assumeTrue(mTM.getTetherableWifiRegexs().length > 0);
+
// Verify that null listener will cause IllegalArgumentException.
try {
mTM.requestLatestTetheringEntitlementResult(
diff --git a/tests/tests/text/src/android/text/format/cts/DateFormatTest.java b/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
index 98c1e52..925b05e 100644
--- a/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
+++ b/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
@@ -352,4 +352,15 @@
"settings put system " + Settings.System.TIME_12_24 + " " + timeFormat);
}
}
+
+ @Test
+ public void test_getBestDateTimePattern() {
+ assertEquals("d MMMM", DateFormat.getBestDateTimePattern(new Locale("ca", "ES"), "MMMMd"));
+ assertEquals("d 'de' MMMM", DateFormat.getBestDateTimePattern(new Locale("es", "ES"),
+ "MMMMd"));
+ assertEquals("d. MMMM", DateFormat.getBestDateTimePattern(new Locale("de", "CH"), "MMMMd"));
+ assertEquals("MMMM d", DateFormat.getBestDateTimePattern(new Locale("en", "US"), "MMMMd"));
+ assertEquals("d LLLL", DateFormat.getBestDateTimePattern(new Locale("fa", "IR"), "MMMMd"));
+ assertEquals("M月d日", DateFormat.getBestDateTimePattern(new Locale("ja", "JP"), "MMMMd"));
+ }
}
diff --git a/tools/cts-api-coverage/Android.bp b/tools/cts-api-coverage/Android.bp
index b0df7f1..95395ed 100644
--- a/tools/cts-api-coverage/Android.bp
+++ b/tools/cts-api-coverage/Android.bp
@@ -35,7 +35,6 @@
// dependencies of all of the tests must be on its classpath. This is
// super fragile.
"tradefed",
- "hosttestlib",
"platformprotos",
],
}
diff --git a/tools/release-parser/Android.bp b/tools/release-parser/Android.bp
index 99b1e29..b2582df 100644
--- a/tools/release-parser/Android.bp
+++ b/tools/release-parser/Android.bp
@@ -35,7 +35,6 @@
// super fragile.
static_libs: [
"compatibility-host-util",
- "hosttestlib",
"dexlib2",
"jsonlib",
"tradefed",