Skip to content

Commit 693dfef

Browse files
author
Android Build Coastguard Worker
committed
Snap for 11157188 from 14e930c to udc-d2-release
Change-Id: I1e640250f1ca49ed5335fe58b76fa19d54b6aaee
2 parents 67cb45a + 14e930c commit 693dfef

10 files changed

Lines changed: 56 additions & 9 deletions

File tree

apps/CameraITS/tests/scene4/test_multi_camera_alignment.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ def test_multi_camera_alignment(self):
388388
if (media_performance_class >= _TEST_REQUIRED_MPC and
389389
not should_run and
390390
cam.is_primary_camera() and
391-
has_multiple_same_facing_cameras):
391+
has_multiple_same_facing_cameras and
392+
props['android.lens.facing'] == _LENS_FACING_BACK):
392393
logging.error('Found multiple camera IDs %s facing in the same '
393394
'direction as primary camera %s.',
394395
cameras_facing_same_direction, self.camera_id)

common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/ScreenDeviceInfo.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,23 @@
1818
import android.app.Activity;
1919
import android.content.Context;
2020
import android.content.res.Configuration;
21+
import android.hardware.devicestate.DeviceStateManager;
22+
import android.os.Build;
2123
import android.os.Bundle;
22-
import android.server.wm.jetpack.utils.SidecarUtil;
2324
import android.server.wm.jetpack.utils.ExtensionUtil;
25+
import android.server.wm.jetpack.utils.SidecarUtil;
2426
import android.server.wm.jetpack.utils.Version;
2527
import android.util.DisplayMetrics;
2628
import android.view.Display;
2729
import android.view.WindowManager;
2830

31+
import androidx.annotation.RequiresApi;
32+
2933
import com.android.compatibility.common.util.DeviceInfoStore;
3034
import com.android.compatibility.common.util.DummyActivity;
3135

36+
import java.io.IOException;
37+
3238
/**
3339
* Screen device info collector.
3440
*/
@@ -39,6 +45,7 @@ protected void collectDeviceInfo(DeviceInfoStore store) throws Exception {
3945
DisplayMetrics metrics = new DisplayMetrics();
4046
WindowManager windowManager =
4147
(WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
48+
4249
Display display = windowManager.getDefaultDisplay();
4350
display.getRealMetrics(metrics);
4451

@@ -55,6 +62,11 @@ protected void collectDeviceInfo(DeviceInfoStore store) throws Exception {
5562

5663
// Add WindowManager Jetpack Library version and available display features.
5764
addDisplayFeaturesIfPresent(store);
65+
66+
// Add device states from DeviceStateManager if available.
67+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
68+
addDeviceStatesIfAvailable(store);
69+
}
5870
}
5971

6072
private void addDisplayFeaturesIfPresent(DeviceInfoStore store) throws Exception {
@@ -85,6 +97,17 @@ private void addDisplayFeaturesIfPresent(DeviceInfoStore store) throws Exception
8597
}
8698
}
8799

100+
@RequiresApi(Build.VERSION_CODES.S)
101+
private void addDeviceStatesIfAvailable(DeviceInfoStore store) throws IOException {
102+
DeviceStateManager deviceStateManager = getContext().getSystemService(
103+
DeviceStateManager.class);
104+
105+
// Get the supported device states on device if DeviceStateManager is available
106+
if (deviceStateManager != null) {
107+
store.addArrayResult("device_states", deviceStateManager.getSupportedStates());
108+
}
109+
}
110+
88111
private static String getScreenSize(Configuration configuration) {
89112
int screenLayout = configuration.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
90113
String screenSize = String.format("0x%x", screenLayout);

hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ public void testSensorsRelatedPermissionsNotGrantedViaPolicy() throws Exception
241241
@RequiresDevice
242242
@Test
243243
public void testAlwaysOnVpn() throws Exception {
244+
assumeIsNotWatch();
244245
int userId = getUserIdForAlwaysOnVpnTests();
245246
installAppAsUser(VPN_APP_APK, userId);
246247
executeDeviceTestClassNoRestrictBackground(".AlwaysOnVpnTest", userId);
@@ -253,6 +254,7 @@ protected int getUserIdForAlwaysOnVpnTests() {
253254
@RequiresDevice
254255
@Test
255256
public void testAlwaysOnVpnLockDown() throws Exception {
257+
assumeIsNotWatch();
256258
int userId = getUserIdForAlwaysOnVpnTests();
257259
installAppAsUser(VPN_APP_APK, userId);
258260
try {
@@ -267,6 +269,7 @@ public void testAlwaysOnVpnLockDown() throws Exception {
267269
@RequiresDevice
268270
@Test
269271
public void testAlwaysOnVpnAcrossReboot() throws Exception {
272+
assumeIsNotWatch();
270273
int userId = getUserIdForAlwaysOnVpnTests();
271274
try {
272275
installAppAsUser(VPN_APP_APK, userId);
@@ -286,6 +289,7 @@ public void testAlwaysOnVpnAcrossReboot() throws Exception {
286289
@RequiresDevice
287290
@Test
288291
public void testAlwaysOnVpnPackageUninstalled() throws Exception {
292+
assumeIsNotWatch();
289293
int userId = getUserIdForAlwaysOnVpnTests();
290294
installAppAsUser(VPN_APP_APK, userId);
291295
try {
@@ -303,6 +307,7 @@ public void testAlwaysOnVpnPackageUninstalled() throws Exception {
303307
@RequiresDevice
304308
@Test
305309
public void testAlwaysOnVpnUnsupportedPackage() throws Exception {
310+
assumeIsNotWatch();
306311
int userId = getUserIdForAlwaysOnVpnTests();
307312
try {
308313
// Target SDK = 23: unsupported
@@ -328,6 +333,7 @@ public void testAlwaysOnVpnUnsupportedPackage() throws Exception {
328333
@RequiresDevice
329334
@Test
330335
public void testAlwaysOnVpnUnsupportedPackageReplaced() throws Exception {
336+
assumeIsNotWatch();
331337
int userId = getUserIdForAlwaysOnVpnTests();
332338
try {
333339
// Target SDK = 24: supported
@@ -350,6 +356,7 @@ public void testAlwaysOnVpnUnsupportedPackageReplaced() throws Exception {
350356
@RequiresDevice
351357
@Test
352358
public void testAlwaysOnVpnPackageLogged() throws Exception {
359+
assumeIsNotWatch();
353360
int userId = getUserIdForAlwaysOnVpnTests();
354361
// Will be uninstalled in tearDown().
355362
installAppAsUser(VPN_APP_APK, userId);
@@ -598,7 +605,7 @@ private void setDefaultContentCaptureServiceEnabled(boolean enabled)
598605
@Test
599606
public void testSetMeteredDataDisabledPackages() throws Exception {
600607
assumeHasWifiFeature();
601-
assumeFalse("is watch", hasDeviceFeature("android.hardware.type.watch"));
608+
assumeIsNotWatch();
602609

603610
installAppAsUser(METERED_DATA_APP_APK, mUserId);
604611

@@ -1567,4 +1574,8 @@ private void restoreRestrictBackgroundPolicyTo(boolean restricted) throws Except
15671574
getDevice().executeShellCommand(
15681575
restricted ? RESTRICT_BACKGROUND_ON_CMD : RESTRICT_BACKGROUND_OFF_CMD);
15691576
}
1577+
1578+
private void assumeIsNotWatch() throws Exception {
1579+
assumeFalse("is watch", hasDeviceFeature("android.hardware.type.watch"));
1580+
}
15701581
}

tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ public void testSoftInputStateAlwaysVisibleFocusedEditorView() throws Exception
425425
@ApiTest(apis = {"android.inputmethodservice.InputMethodService#showSoftInput"})
426426
@Test
427427
public void testSoftInputStateAlwaysVisibleFocusEditorAfterLaunch() throws Exception {
428+
Assume.assumeFalse(isPreventImeStartup());
428429
final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
429430
try (MockImeSession imeSession = createTestImeSession()) {
430431
final ImeEventStream stream = imeSession.openEventStream();

tests/inputmethod/src/android/view/inputmethod/cts/ImeInsetsVisibilityTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
import com.android.cts.mockime.ImeSettings;
7171
import com.android.cts.mockime.MockImeSession;
7272

73+
import org.junit.Assume;
7374
import org.junit.Rule;
7475
import org.junit.Test;
7576
import org.junit.runner.RunWith;
@@ -96,6 +97,7 @@ private static String getTestMarker() {
9697

9798
@Test
9899
public void testImeVisibilityWhenImeFocusableChildPopup() throws Exception {
100+
Assume.assumeFalse(isPreventImeStartup());
99101
final InputMethodManager imm = getImmOrFail();
100102

101103
try (MockImeSession imeSession = MockImeSession.create(
@@ -143,6 +145,7 @@ public void testImeVisibilityWhenImeFocusableChildPopup() throws Exception {
143145

144146
@Test
145147
public void testImeVisibilityWhenImeFocusableGravityBottomChildPopup() throws Exception {
148+
Assume.assumeFalse(isPreventImeStartup());
146149
final InputMethodManager imm = getImmOrFail();
147150

148151
try (MockImeSession imeSession = MockImeSession.create(
@@ -191,6 +194,7 @@ public void testImeVisibilityWhenImeFocusableGravityBottomChildPopup() throws Ex
191194

192195
@Test
193196
public void testImeVisibilityWhenImeFocusableChildPopupOverlaps() throws Exception {
197+
Assume.assumeFalse(isPreventImeStartup());
194198
final InputMethodManager imm = getImmOrFail();
195199

196200
try (MockImeSession imeSession = MockImeSession.create(
@@ -240,6 +244,7 @@ public void testImeVisibilityWhenImeFocusableChildPopupOverlaps() throws Excepti
240244
@AppModeFull(reason = "Instant apps cannot rely on ACTION_CLOSE_SYSTEM_DIALOGS")
241245
@Test
242246
public void testEditTextPositionAndPersistWhenAboveImeWindowShown() throws Exception {
247+
Assume.assumeFalse(isPreventImeStartup());
243248
final InputMethodManager imm = getImmOrFail();
244249

245250
try (MockImeSession imeSession = MockImeSession.create(

tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
import com.android.cts.mockime.ImeSettings;
105105
import com.android.cts.mockime.MockImeSession;
106106

107+
import org.junit.Assume;
107108
import org.junit.Before;
108109
import org.junit.Ignore;
109110
import org.junit.Rule;
@@ -210,6 +211,7 @@ public void verifyLayoutInflaterContext() throws Exception {
210211

211212
@Test
212213
public void testSwitchInputMethod_verifiesEnabledState() throws Exception {
214+
Assume.assumeFalse(isPreventImeStartup());
213215
SystemUtil.runShellCommand("ime disable " + OTHER_IME_ID);
214216
try (MockImeSession imeSession = MockImeSession.create(
215217
InstrumentationRegistry.getInstrumentation().getContext(),
@@ -233,6 +235,7 @@ public void testSwitchInputMethod_verifiesEnabledState() throws Exception {
233235
}
234236
@Test
235237
public void testSwitchInputMethodWithSubtype_verifiesEnabledState() throws Exception {
238+
Assume.assumeFalse(isPreventImeStartup());
236239
SystemUtil.runShellCommand("ime disable " + OTHER_IME_ID);
237240
try (MockImeSession imeSession = MockImeSession.create(
238241
InstrumentationRegistry.getInstrumentation().getContext(),

tests/inputmethod/src/android/view/inputmethod/cts/SearchViewTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import com.android.cts.mockime.ImeSettings;
4949
import com.android.cts.mockime.MockImeSession;
5050

51+
import org.junit.Assume;
5152
import org.junit.Rule;
5253
import org.junit.Test;
5354
import org.junit.runner.RunWith;
@@ -179,6 +180,7 @@ public void testShowImeWithSearchViewFocus() throws Exception {
179180

180181
@Test
181182
public void testShowImeWhenSearchViewFocusInListView() throws Exception {
183+
Assume.assumeFalse(isPreventImeStartup());
182184
try (MockImeSession imeSession = MockImeSession.create(
183185
InstrumentationRegistry.getInstrumentation().getContext(),
184186
InstrumentationRegistry.getInstrumentation().getUiAutomation(),

tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanLargerThanVerification.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class MeanLargerThanVerification extends AbstractMeanVerification {
3333
public static final String PASSED_KEY = "mean_larger_than_passed";
3434
private static final String TAG = "MeanLargerThanVerification";
3535

36-
private static final float DEFAULT_GYRO_UNCAL_THRESHOLD = 0.0005f;
36+
private static final float DEFAULT_GYRO_UNCAL_THRESHOLD = 0.0002f;
3737

3838
private final float[] mExpected;
3939
private final float[] mThresholds;

tests/tests/graphics/src/android/graphics/cts/FrameRateCtsActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ private List<Float> getSeamedRefreshRates(Display.Mode mode, Display display) {
440440
List<Float> seamedRefreshRates = new ArrayList<>();
441441
Display.Mode[] modes = display.getSupportedModes();
442442
for (Display.Mode otherMode : modes) {
443-
if (!DisplayUtil.isModeSwitchSeamless(mode, otherMode)) {
443+
if (hasSameResolution(mode, otherMode)
444+
&& !DisplayUtil.isModeSwitchSeamless(mode, otherMode)) {
444445
seamedRefreshRates.add(otherMode.getRefreshRate());
445446
}
446447
}

tests/tests/media/decoder/src/android/media/decoder/cts/DecodeOnlyTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public void onInputBufferAvailable(MediaCodec codec, int index) {
240240
ByteBuffer inputBuffer = videoCodec.getInputBuffer(index);
241241
int sampleSize = videoExtractor.readSampleData(inputBuffer, 0);
242242
long presentationTime = videoExtractor.getSampleTime();
243-
int flags = videoExtractor.getSampleFlags();
243+
int flags = 0;
244244
if (sampleSize < 0) {
245245
flags = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
246246
sampleSize = 0;
@@ -355,7 +355,7 @@ public void onInputBufferAvailable(MediaCodec codec, int index) {
355355
ByteBuffer inputBuffer = videoCodec.getInputBuffer(index);
356356
int sampleSize = videoExtractor.readSampleData(inputBuffer, 0);
357357
long presentationTime = videoExtractor.getSampleTime();
358-
int flags = videoExtractor.getSampleFlags();
358+
int flags = 0;
359359
if (sampleSize < 0) {
360360
flags = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
361361
sampleSize = 0;
@@ -497,7 +497,7 @@ private void queueInput(MediaCodec codec, int index) {
497497
ByteBuffer inputBuffer = codec.getInputBuffer(index);
498498
int sampleSize = videoExtractor.readSampleData(inputBuffer, 0);
499499
long presentationTime = videoExtractor.getSampleTime();
500-
int flags = videoExtractor.getSampleFlags();
500+
int flags = 0;
501501
if (sampleSize < 0) {
502502
flags = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
503503
sampleSize = 0;
@@ -796,7 +796,7 @@ public void onInputBufferAvailable(MediaCodec codec, int index) {
796796
ByteBuffer audioInputBuffer = mAudioCodec.getInputBuffer(index);
797797
int audioSampleSize = mAudioExtractor.readSampleData(audioInputBuffer, 0);
798798
long presentationTime = mAudioExtractor.getSampleTime();
799-
int flags = mAudioExtractor.getSampleFlags();
799+
int flags = 0;
800800
if (audioSampleSize < 0) {
801801
flags = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
802802
audioSampleSize = 0;

0 commit comments

Comments
 (0)