Merge "Camera2: mark testPreparePerformance as known failure" into mnc-dev
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/DetermineFovActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/DetermineFovActivity.java
index 8b989e1..959e98f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/DetermineFovActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/DetermineFovActivity.java
@@ -145,7 +145,7 @@
mTargetDistanceCm = getTargetDistance();
mReportedFovDegrees = PhotoCaptureActivity.getReportedFovDegrees();
- mFovDegrees = mReportedFovDegrees > 80 ? 60 : mReportedFovDegrees;
+ mFovDegrees = mReportedFovDegrees > 120 ? 60 : mReportedFovDegrees;
mFovMaxDegrees = mFovDegrees + FOV_ADJUSTMENT_RANGE / 2;
mFovMinDegrees = mFovDegrees - FOV_ADJUSTMENT_RANGE / 2;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsSerializer.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsSerializer.java
index 57d0c8f..9abfa9a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsSerializer.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsSerializer.java
@@ -151,6 +151,19 @@
cfgArray.put(obj);
}
}
+ sizes = map.getHighResolutionOutputSizes(fmts[fi]);
+ if (sizes != null) {
+ for (int si = 0; si < Array.getLength(sizes); si++) {
+ JSONObject obj = new JSONObject();
+ obj.put("format", fmts[fi]);
+ obj.put("width",sizes[si].getWidth());
+ obj.put("height", sizes[si].getHeight());
+ obj.put("input", false);
+ obj.put("minFrameDuration",
+ map.getOutputMinFrameDuration(fmts[fi],sizes[si]));
+ cfgArray.put(obj);
+ }
+ }
}
}
mapObj.put("availableStreamConfigurations", cfgArray);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
index 85b8a18..5b034fe 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
@@ -1077,10 +1077,10 @@
"Zero stream configs available for requested format: %s",
sformat));
}
- width = sizes[0].getWidth();
+ width = ItsUtils.getMaxSize(sizes).getWidth();
}
if (height <= 0) {
- height = sizes[0].getHeight();
+ height = ItsUtils.getMaxSize(sizes).getHeight();
}
outputSizes[i] = new Size(width, height);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsUtils.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsUtils.java
index fddee4d..6fd050b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsUtils.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsUtils.java
@@ -128,10 +128,24 @@
if (configMap == null) {
throw new ItsException("Failed to get stream config");
}
- return configMap.getOutputSizes(format);
+ Size[] normalSizes = configMap.getOutputSizes(format);
+ Size[] slowSizes = configMap.getHighResolutionOutputSizes(format);
+ Size[] allSizes = null;
+ if (normalSizes != null && slowSizes != null) {
+ allSizes = new Size[normalSizes.length + slowSizes.length];
+ System.arraycopy(normalSizes, 0, allSizes, 0,
+ normalSizes.length);
+ System.arraycopy(slowSizes, 0, allSizes, normalSizes.length,
+ slowSizes.length);
+ } else if (normalSizes != null) {
+ allSizes = normalSizes;
+ } else if (slowSizes != null) {
+ allSizes = slowSizes;
+ }
+ return allSizes;
}
- private static Size getMaxSize(Size[] sizes) {
+ public static Size getMaxSize(Size[] sizes) {
if (sizes == null || sizes.length == 0) {
throw new IllegalArgumentException("sizes was empty");
}
@@ -252,4 +266,3 @@
}
}
}
-
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PermissionsTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PermissionsTest.java
index 2faf158..1cc2ee2 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PermissionsTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PermissionsTest.java
@@ -30,6 +30,8 @@
public class PermissionsTest extends BaseManagedProfileTest {
private static final String SIMPLE_APP_PACKAGE_NAME = "com.android.cts.launcherapps.simpleapp";
+ private static final String SIMPLE_PRE_M_APP_PACKAGE_NAME =
+ "com.android.cts.launcherapps.simplepremapp";
private static final String PERMISSION_NAME = "android.permission.READ_CONTACTS";
@Override
@@ -47,8 +49,8 @@
mDevicePolicyManager.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME,
DevicePolicyManager.PERMISSION_GRANT_STATE_DENIED);
- assertTrue(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
- SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME) ==
+ assertEquals(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+ SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME),
DevicePolicyManager.PERMISSION_GRANT_STATE_DENIED);
assertEquals(pm.checkPermission(PERMISSION_NAME, SIMPLE_APP_PACKAGE_NAME),
PackageManager.PERMISSION_DENIED);
@@ -56,8 +58,8 @@
mDevicePolicyManager.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME,
DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT);
- assertTrue(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
- SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME) ==
+ assertEquals(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+ SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME),
DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT);
// Should stay denied
assertEquals(pm.checkPermission(PERMISSION_NAME, SIMPLE_APP_PACKAGE_NAME),
@@ -66,8 +68,8 @@
mDevicePolicyManager.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME,
DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED);
- assertTrue(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
- SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME) ==
+ assertEquals(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+ SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME),
DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED);
assertEquals(pm.checkPermission(PERMISSION_NAME, SIMPLE_APP_PACKAGE_NAME),
PackageManager.PERMISSION_GRANTED);
@@ -75,8 +77,8 @@
mDevicePolicyManager.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME,
DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT);
- assertTrue(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
- SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME) ==
+ assertEquals(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+ SIMPLE_APP_PACKAGE_NAME, PERMISSION_NAME),
DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT);
// Should stay granted
assertEquals(pm.checkPermission(PERMISSION_NAME, SIMPLE_APP_PACKAGE_NAME),
@@ -97,4 +99,29 @@
assertEquals(mDevicePolicyManager.getPermissionPolicy(ADMIN_RECEIVER_COMPONENT),
DevicePolicyManager.PERMISSION_POLICY_PROMPT);
}
+
+ public void testPermissionGrantStatePreMApp() {
+ // These tests are to make sure that pre-M apps are not granted runtime permissions
+ // by a profile owner
+ PackageManager pm = mContext.getPackageManager();
+ assertFalse(mDevicePolicyManager.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+ SIMPLE_PRE_M_APP_PACKAGE_NAME, PERMISSION_NAME,
+ DevicePolicyManager.PERMISSION_GRANT_STATE_DENIED));
+ assertEquals(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+ SIMPLE_PRE_M_APP_PACKAGE_NAME, PERMISSION_NAME),
+ DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT);
+ // Install time permissions should always be granted
+ assertEquals(pm.checkPermission(PERMISSION_NAME, SIMPLE_PRE_M_APP_PACKAGE_NAME),
+ PackageManager.PERMISSION_GRANTED);
+
+ mDevicePolicyManager.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+ SIMPLE_PRE_M_APP_PACKAGE_NAME, PERMISSION_NAME,
+ DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED);
+ assertEquals(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+ SIMPLE_PRE_M_APP_PACKAGE_NAME, PERMISSION_NAME),
+ DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT);
+ // Install time permissions should always be granted
+ assertEquals(pm.checkPermission(PERMISSION_NAME, SIMPLE_PRE_M_APP_PACKAGE_NAME),
+ PackageManager.PERMISSION_GRANTED);
+ }
}
diff --git a/hostsidetests/devicepolicy/app/SimplePreMApp/Android.mk b/hostsidetests/devicepolicy/app/SimplePreMApp/Android.mk
new file mode 100644
index 0000000..7460552
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SimplePreMApp/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2015 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.
+
+# This app is meant for testing device policy permission APIs on legacy apps (pre-M)
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# Don't include this package in any target.
+LOCAL_MODULE_TAGS := optional
+
+# When built, explicitly put it in the data partition.
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := CtsSimplePreMApp
+
+LOCAL_SDK_VERSION := 21
+
+include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/SimplePreMApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/SimplePreMApp/AndroidManifest.xml
new file mode 100644
index 0000000..85962a1
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SimplePreMApp/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2015 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.launcherapps.simplepremapp">
+
+ <uses-sdk android:targetSdkVersion="21"/>
+
+ <uses-permission android:name="android.permission.READ_CONTACTS"/>
+
+ <application>
+ <activity android:name=".SimpleActivity" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
+
diff --git a/hostsidetests/devicepolicy/app/SimplePreMApp/src/com/android/cts/launcherapps/simplepremapp/SimpleActivity.java b/hostsidetests/devicepolicy/app/SimplePreMApp/src/com/android/cts/launcherapps/simplepremapp/SimpleActivity.java
new file mode 100644
index 0000000..0dba719
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SimplePreMApp/src/com/android/cts/launcherapps/simplepremapp/SimpleActivity.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 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 com.android.cts.launcherapps.simplepremapp;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+import java.lang.Override;
+
+/**
+ * A simple activity to install for various users to test LauncherApps.
+ */
+public class SimpleActivity extends Activity {
+
+ private static final String TAG = "SimpleActivity";
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ Log.i(TAG, "Created for user " + android.os.Process.myUserHandle());
+ }
+
+}
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
index 255c49e..856599e 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
@@ -31,6 +31,7 @@
private static final String MANAGED_PROFILE_APK = "CtsManagedProfileApp.apk";
private static final String SIMPLE_APP_APK = "CtsSimpleApp.apk";
+ private static final String SIMPLE_PRE_M_APP_APK = "CtsSimplePreMApp.apk";
private static final String INTENT_SENDER_PKG = "com.android.cts.intent.sender";
private static final String INTENT_SENDER_APK = "CtsIntentSenderApp.apk";
@@ -417,11 +418,20 @@
if (!mHasFeature) {
return;
}
- installApp(SIMPLE_APP_APK);
+ installAppAsUser(SIMPLE_APP_APK, mUserId);
assertTrue(runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".PermissionsTest",
"testPermissionGrantState", mUserId));
}
+ public void testPermissionGrantPreMApp() throws Exception {
+ if (!mHasFeature) {
+ return;
+ }
+ installAppAsUser(SIMPLE_PRE_M_APP_APK, mUserId);
+ assertTrue(runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".PermissionsTest",
+ "testPermissionGrantStatePreMApp", mUserId));
+ }
+
private void disableActivityForUser(String activityName, int userId)
throws DeviceNotAvailableException {
String command = "am start -W --user " + userId
diff --git a/tests/expectations/knownfailures.txt b/tests/expectations/knownfailures.txt
index f65cf46..b6b5206 100644
--- a/tests/expectations/knownfailures.txt
+++ b/tests/expectations/knownfailures.txt
@@ -166,6 +166,7 @@
],
bug: 18030049
},
+<<<<<<< HEAD
{
description: "The new recording test is not yet passing on all devices",
names: [
diff --git a/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java b/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
index 0e84fb9..4350191 100644
--- a/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
+++ b/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
@@ -1452,27 +1452,14 @@
}
/**
- * Tests the setting of lastAuthenticatedTime on accountAuthenticated being
- * successful.
- */
- public void testLastAuthenticatedTimeAfterAccountAuthenticated() throws IOException,
- AuthenticatorException, OperationCanceledException {
- long accountAddTime = addAccountAndReturnAccountAddedTime(ACCOUNT, ACCOUNT_PASSWORD);
- mockAuthenticator.callAccountAuthenticated();
- long accountAuthenticatedTime = getLastAuthenticatedTime(ACCOUNT);
- assertTrue(accountAuthenticatedTime > accountAddTime);
- }
-
- /**
- * Tests the setting of lastAuthenticatedTime on setPassword being
- * successful.
+ * LastAuthenticatedTime on setPassword should not be disturbed.
*/
public void testLastAuthenticatedTimeAfterSetPassword() throws IOException,
AuthenticatorException, OperationCanceledException {
long accountAddTime = addAccountAndReturnAccountAddedTime(ACCOUNT, ACCOUNT_PASSWORD);
mockAuthenticator.callSetPassword();
long setPasswordTime = getLastAuthenticatedTime(ACCOUNT);
- assertTrue(setPasswordTime > accountAddTime);
+ assertTrue(setPasswordTime == accountAddTime);
}
/**
@@ -1947,7 +1934,14 @@
private long addAccountAndReturnAccountAddedTime(Account account, String password)
throws OperationCanceledException, AuthenticatorException, IOException {
- addAccountExplicitly(account, password, null /* userData */);
+ addAccount(am,
+ ACCOUNT_TYPE,
+ AUTH_TOKEN_TYPE,
+ REQUIRED_FEATURES,
+ OPTIONS_BUNDLE,
+ mActivity,
+ null /* callback */,
+ null /* handler */);
return getLastAuthenticatedTime(account);
}
diff --git a/tests/tests/accounts/src/android/accounts/cts/MockAccountAuthenticator.java b/tests/tests/accounts/src/android/accounts/cts/MockAccountAuthenticator.java
index faebd53..c1b08de 100644
--- a/tests/tests/accounts/src/android/accounts/cts/MockAccountAuthenticator.java
+++ b/tests/tests/accounts/src/android/accounts/cts/MockAccountAuthenticator.java
@@ -151,6 +151,8 @@
this.mAuthTokenType = authTokenType;
this.mRequiredFeatures = requiredFeatures;
this.mOptionsAddAccount = options;
+ AccountManager am = AccountManager.get(mContext);
+ am.addAccountExplicitly(AccountManagerTest.ACCOUNT, "fakePassword", null);
return createResultBundle();
}
diff --git a/tests/tests/graphics/src/android/graphics/cts/PaintTest.java b/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
index 9f2086d..80e0253 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
@@ -928,6 +928,20 @@
assertMeasureText(text, textChars, textSpan, 4, 7, widths[4] + widths[5] + widths[6]);
}
+ public void testMeasureTextContext() {
+ Paint p = new Paint();
+ // Arabic LAM, which is different width depending on context
+ String shortString = "\u0644";
+ String longString = "\u0644\u0644\u0644";
+ char[] longChars = longString.toCharArray();
+ SpannedString longSpanned = new SpannedString(longString);
+ float width = p.measureText(shortString);
+ // Verify that measurement of substring is consistent no matter what surrounds it.
+ assertMeasureText(longString, longChars, longSpanned, 0, 1, width);
+ assertMeasureText(longString, longChars, longSpanned, 1, 2, width);
+ assertMeasureText(longString, longChars, longSpanned, 2, 3, width);
+ }
+
public void testMeasureTextWithLongText() {
// This test is not compatible with 4.0.3
if ("4.0.3".equals(Build.VERSION.RELEASE)) {
diff --git a/tests/tests/hardware/src/android/hardware/camera2/cts/Camera2SurfaceViewCtsActivity.java b/tests/tests/hardware/src/android/hardware/camera2/cts/Camera2SurfaceViewCtsActivity.java
index 936883e..1881774 100644
--- a/tests/tests/hardware/src/android/hardware/camera2/cts/Camera2SurfaceViewCtsActivity.java
+++ b/tests/tests/hardware/src/android/hardware/camera2/cts/Camera2SurfaceViewCtsActivity.java
@@ -19,6 +19,7 @@
import android.app.Activity;
import android.os.Bundle;
import android.os.ConditionVariable;
+import android.os.SystemClock;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
@@ -57,7 +58,7 @@
int waitTimeMs = timeOutMs;
boolean changeSucceeded = false;
while (!changeSucceeded && waitTimeMs > 0) {
- long startTimeMs = System.currentTimeMillis();
+ long startTimeMs = SystemClock.elapsedRealtime();
changeSucceeded = surfaceChangedDone.block(waitTimeMs);
if (!changeSucceeded) {
Log.e(TAG, "Wait for surface change timed out after " + timeOutMs + " ms");
@@ -72,7 +73,7 @@
// again.
changeSucceeded = false;
}
- waitTimeMs -= (System.currentTimeMillis() - startTimeMs);
+ waitTimeMs -= (SystemClock.elapsedRealtime() - startTimeMs);
}
// Couldn't get expected surface size change.
diff --git a/tests/tests/hardware/src/android/hardware/camera2/cts/CameraTestUtils.java b/tests/tests/hardware/src/android/hardware/camera2/cts/CameraTestUtils.java
index b744686..ed8f7b7 100644
--- a/tests/tests/hardware/src/android/hardware/camera2/cts/CameraTestUtils.java
+++ b/tests/tests/hardware/src/android/hardware/camera2/cts/CameraTestUtils.java
@@ -947,6 +947,44 @@
Size[] availableSizes = configMap.getOutputSizes(format);
assertArrayNotEmpty(availableSizes, "availableSizes should not be empty for format: "
+ format);
+ Size[] highResAvailableSizes = configMap.getHighResolutionOutputSizes(format);
+ if (highResAvailableSizes != null && highResAvailableSizes.length > 0) {
+ Size[] allSizes = new Size[availableSizes.length + highResAvailableSizes.length];
+ System.arraycopy(availableSizes, 0, allSizes, 0,
+ availableSizes.length);
+ System.arraycopy(highResAvailableSizes, 0, allSizes, availableSizes.length,
+ highResAvailableSizes.length);
+ availableSizes = allSizes;
+ }
+ if (VERBOSE) Log.v(TAG, "Supported sizes are: " + Arrays.deepToString(availableSizes));
+ return availableSizes;
+ }
+
+ /**
+ * Get the available output sizes for the given class.
+ *
+ */
+ public static Size[] getSupportedSizeForClass(Class klass, String cameraId,
+ CameraManager cameraManager) throws CameraAccessException {
+ CameraCharacteristics properties = cameraManager.getCameraCharacteristics(cameraId);
+ assertNotNull("Can't get camera characteristics!", properties);
+ if (VERBOSE) {
+ Log.v(TAG, "get camera characteristics for camera: " + cameraId);
+ }
+ StreamConfigurationMap configMap =
+ properties.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
+ Size[] availableSizes = configMap.getOutputSizes(klass);
+ assertArrayNotEmpty(availableSizes, "availableSizes should not be empty for class: "
+ + klass);
+ Size[] highResAvailableSizes = configMap.getHighResolutionOutputSizes(ImageFormat.PRIVATE);
+ if (highResAvailableSizes != null && highResAvailableSizes.length > 0) {
+ Size[] allSizes = new Size[availableSizes.length + highResAvailableSizes.length];
+ System.arraycopy(availableSizes, 0, allSizes, 0,
+ availableSizes.length);
+ System.arraycopy(highResAvailableSizes, 0, allSizes, availableSizes.length,
+ highResAvailableSizes.length);
+ availableSizes = allSizes;
+ }
if (VERBOSE) Log.v(TAG, "Supported sizes are: " + Arrays.deepToString(availableSizes));
return availableSizes;
}
@@ -970,10 +1008,9 @@
*/
static public List<Size> getSupportedPreviewSizes(String cameraId,
CameraManager cameraManager, Size bound) throws CameraAccessException {
- CameraCharacteristics props = cameraManager.getCameraCharacteristics(cameraId);
- StreamConfigurationMap config =
- props.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
- Size[] rawSizes = config.getOutputSizes(android.view.SurfaceHolder.class);
+
+ Size[] rawSizes = getSupportedSizeForClass(android.view.SurfaceHolder.class, cameraId,
+ cameraManager);
assertArrayNotEmpty(rawSizes,
"Available sizes for SurfaceHolder class should not be empty");
if (VERBOSE) {
@@ -1059,10 +1096,9 @@
*/
static public List<Size> getSupportedVideoSizes(String cameraId,
CameraManager cameraManager, Size bound) throws CameraAccessException {
- CameraCharacteristics props = cameraManager.getCameraCharacteristics(cameraId);
- StreamConfigurationMap config =
- props.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
- Size[] rawSizes = config.getOutputSizes(android.media.MediaRecorder.class);
+
+ Size[] rawSizes = getSupportedSizeForClass(android.media.MediaRecorder.class,
+ cameraId, cameraManager);
assertArrayNotEmpty(rawSizes,
"Available sizes for MediaRecorder class should not be empty");
if (VERBOSE) {
diff --git a/tests/tests/hardware/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java b/tests/tests/hardware/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
index 695df10..99f7091 100644
--- a/tests/tests/hardware/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
+++ b/tests/tests/hardware/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
@@ -373,7 +373,7 @@
/**
* Test values for static metadata used by the BURST capability.
*/
- public void testStaticBurstCharacteristics() {
+ public void testStaticBurstCharacteristics() throws Exception {
int counter = 0;
final float SIZE_ERROR_MARGIN = 0.03f;
for (CameraCharacteristics c : mCharacteristics) {
@@ -404,7 +404,9 @@
Size maxSlowYuvSize = CameraTestUtils.getMaxSize(slowYuvSizes);
maxYuvSize = CameraTestUtils.getMaxSize(new Size[]{maxYuvSize, maxSlowYuvSize});
}
- Size maxJpegSize = CameraTestUtils.getMaxSize(config.getOutputSizes(ImageFormat.JPEG));
+
+ Size maxJpegSize = CameraTestUtils.getMaxSize(CameraTestUtils.getSupportedSizeForFormat(
+ ImageFormat.JPEG, mIds[counter], mCameraManager));
boolean haveMaxYuv = maxYuvSize != null ?
(maxJpegSize.getWidth() <= maxYuvSize.getWidth() &&
@@ -599,7 +601,7 @@
/**
* Cross-check StreamConfigurationMap output
*/
- public void testStreamConfigurationMap() {
+ public void testStreamConfigurationMap() throws Exception {
int counter = 0;
for (CameraCharacteristics c : mCharacteristics) {
Log.i(TAG, "testStreamConfigurationMap: Testing camera ID " + mIds[counter]);
@@ -754,7 +756,8 @@
SurfaceTexture st = new SurfaceTexture(1);
Surface surf = new Surface(st);
- Size[] opaqueSizes = config.getOutputSizes(SurfaceTexture.class);
+ Size[] opaqueSizes = CameraTestUtils.getSupportedSizeForClass(SurfaceTexture.class,
+ mIds[counter], mCameraManager);
assertTrue("Opaque format has no sizes listed",
opaqueSizes.length > 0);
for (Size size : opaqueSizes) {
@@ -798,7 +801,8 @@
* Test high speed capability and cross-check the high speed sizes and fps ranges from
* the StreamConfigurationMap.
*/
- public void testConstrainedHighSpeedCapability() {
+ public void testConstrainedHighSpeedCapability() throws Exception {
+ int counter = 0;
for (CameraCharacteristics c : mCharacteristics) {
int[] capabilities = CameraTestUtils.getValueNotNull(
c, CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
@@ -809,7 +813,8 @@
c, CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
List<Size> highSpeedSizes = Arrays.asList(config.getHighSpeedVideoSizes());
assertTrue("High speed sizes shouldn't be empty", highSpeedSizes.size() > 0);
- Size[] allSizes = config.getOutputSizes(ImageFormat.PRIVATE);
+ Size[] allSizes = CameraTestUtils.getSupportedSizeForFormat(ImageFormat.PRIVATE,
+ mIds[counter], mCameraManager);
assertTrue("Normal size for PRIVATE format shouldn't be null or empty",
allSizes != null && allSizes.length > 0);
for (Size size: highSpeedSizes) {
@@ -869,6 +874,7 @@
}
}
}
+ counter++;
}
}
diff --git a/tests/tests/hardware/src/android/hardware/camera2/cts/StaticMetadataTest.java b/tests/tests/hardware/src/android/hardware/camera2/cts/StaticMetadataTest.java
index e876d1b..0bc74b3 100644
--- a/tests/tests/hardware/src/android/hardware/camera2/cts/StaticMetadataTest.java
+++ b/tests/tests/hardware/src/android/hardware/camera2/cts/StaticMetadataTest.java
@@ -86,10 +86,6 @@
mCollector.expectTrue("Full device must contain BURST_CAPTURE capability",
availableCaps.contains(REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE));
- // Max resolution fps must be >= 20.
- mCollector.expectTrue("Full device must support at least 20fps for max resolution",
- getFpsForMaxSize(id) >= MIN_FPS_FOR_FULL_DEVICE);
-
// Need support per frame control
mCollector.expectTrue("Full device must support per frame control",
mStaticInfo.isPerFrameControlSupported());
diff --git a/tests/tests/hardware/src/android/hardware/camera2/cts/helpers/StaticMetadata.java b/tests/tests/hardware/src/android/hardware/camera2/cts/helpers/StaticMetadata.java
index a828371..e26cf7a 100644
--- a/tests/tests/hardware/src/android/hardware/camera2/cts/helpers/StaticMetadata.java
+++ b/tests/tests/hardware/src/android/hardware/camera2/cts/helpers/StaticMetadata.java
@@ -1446,7 +1446,8 @@
return minDurationMap;
}
- for (android.util.Size size : config.getOutputSizes(format)) {
+ for (android.util.Size size : getAvailableSizesForFormatChecked(format,
+ StreamDirection.Output)) {
long minFrameDuration = config.getOutputMinFrameDuration(format, size);
if (minFrameDuration != 0) {
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
index 019bd21..ec9caaf 100644
--- a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
@@ -37,6 +37,7 @@
import android.os.ConditionVariable;
import android.os.Environment;
import android.os.Looper;
+import android.os.SystemClock;
import android.test.ActivityInstrumentationTestCase2;
import android.test.MoreAsserts;
import android.test.UiThreadTest;
@@ -1975,7 +1976,7 @@
// This method tests if the actual fps is between minimum and maximum.
// It also tests if the frame interval is too long.
public void onPreviewFrame(byte[] data, android.hardware.Camera camera) {
- long arrivalTime = System.currentTimeMillis();
+ long arrivalTime = SystemClock.elapsedRealtime();
camera.addCallbackBuffer(data);
if (firstFrameArrivalTime == 0) firstFrameArrivalTime = arrivalTime;
diff --git a/tests/tests/os/Android.mk b/tests/tests/os/Android.mk
index 9dfb86e..f4b140e 100644
--- a/tests/tests/os/Android.mk
+++ b/tests/tests/os/Android.mk
@@ -31,6 +31,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
src/android/os/cts/IParcelFileDescriptorPeer.aidl \
src/android/os/cts/IEmptyService.aidl \
+ src/android/os/cts/ISeccompIsolatedService.aidl \
src/android/os/cts/ISecondary.aidl
LOCAL_PACKAGE_NAME := CtsOsTestCases
diff --git a/tests/tests/os/AndroidManifest.xml b/tests/tests/os/AndroidManifest.xml
index f225903..deb7045 100644
--- a/tests/tests/os/AndroidManifest.xml
+++ b/tests/tests/os/AndroidManifest.xml
@@ -120,6 +120,10 @@
</intent-filter>
</service>
+ <service android:name="android.os.cts.SeccompTest$IsolatedService"
+ android:isolatedProcess="true">
+ </service>
+
<service android:name="android.os.cts.MessengerService"
android:process=":messengerService">
</service>
diff --git a/tests/tests/os/jni/Android.mk b/tests/tests/os/jni/Android.mk
index fab1ec2..24a0651 100644
--- a/tests/tests/os/jni/Android.mk
+++ b/tests/tests/os/jni/Android.mk
@@ -47,7 +47,9 @@
endif
ifeq ($(ARCH_SUPPORTS_SECCOMP),1)
- LOCAL_SRC_FILES += seccomp-tests/tests/seccomp_bpf_tests.c
+ LOCAL_SRC_FILES += seccomp-tests/tests/seccomp_bpf_tests.c \
+ seccomp_sample_program.cpp
+
# This define controls the behavior of OSFeatures.needsSeccompSupport().
LOCAL_CFLAGS += -DARCH_SUPPORTS_SECCOMP
endif
diff --git a/tests/tests/os/jni/android_os_cts_SeccompTest.cpp b/tests/tests/os/jni/android_os_cts_SeccompTest.cpp
index cd1543d..528696b 100644
--- a/tests/tests/os/jni/android_os_cts_SeccompTest.cpp
+++ b/tests/tests/os/jni/android_os_cts_SeccompTest.cpp
@@ -17,7 +17,15 @@
#include <android/log.h>
#include <jni.h>
#include <string.h>
+#include <time.h>
+#if defined(ARCH_SUPPORTS_SECCOMP)
+#include <linux/filter.h>
+#include <linux/seccomp.h>
+#include <sys/syscall.h>
+#endif
+
+#include "seccomp_sample_program.h"
#include "seccomp-tests/tests/test_harness.h"
// Forward declare from seccomp_bpf_tests.c.
@@ -46,9 +54,33 @@
return false;
}
+jboolean android_security_cts_SeccompBpfTest_installTestFilter(JNIEnv*, jclass) {
+#if !defined(ARCH_SUPPORTS_SECCOMP)
+ return false;
+#else
+ struct sock_fprog prog = GetTestSeccompFilterProgram();
+
+ if (prog.len == 0)
+ return false;
+
+ int rv = syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, SECCOMP_FILTER_FLAG_TSYNC, &prog);
+ return rv == 0;
+#endif
+}
+
+jint android_security_cts_SeccompBpfTest_getClockBootTime(JNIEnv*, jclass) {
+ struct timespec ts;
+ int rv = clock_gettime(CLOCK_BOOTTIME, &ts);
+ return rv;
+}
+
static JNINativeMethod methods[] = {
{ "runKernelUnitTest", "(Ljava/lang/String;)Z",
(void*)android_security_cts_SeccompBpfTest_runKernelUnitTest },
+ { "installTestFilter", "()Z",
+ (void*)android_security_cts_SeccompBpfTest_installTestFilter },
+ { "getClockBootTime", "()I",
+ (void*)android_security_cts_SeccompBpfTest_getClockBootTime },
};
int register_android_os_cts_SeccompTest(JNIEnv* env) {
diff --git a/tests/tests/os/jni/seccomp_sample_program.cpp b/tests/tests/os/jni/seccomp_sample_program.cpp
new file mode 100644
index 0000000..e291e8a
--- /dev/null
+++ b/tests/tests/os/jni/seccomp_sample_program.cpp
@@ -0,0 +1,1458 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#include <linux/filter.h>
+
+// This file defines a sample seccomp-bpf policy. It is taken from the
+// Chromium renderer process policy applied to isolatedProcess services.
+//
+// In the future, this policy should be further restricted to just the set
+// of system calls that an isolatedProcess should be allowed to make.
+
+#if defined(__arm__)
+struct sock_filter kTestSeccompFilter[] = {
+ {0x20, 0, 0, 0x4},
+ {0x15, 1, 0, 0x40000028},
+ {0x6, 0, 0, 0x30006},
+ {0x20, 0, 0, 0x0},
+ {0x35, 0, 90, 0xab},
+ {0x35, 0, 43, 0x108},
+ {0x35, 0, 21, 0x14f},
+ {0x35, 0, 10, 0x168},
+ {0x35, 0, 5, 0x181},
+ {0x35, 0, 2, 0xf0006},
+ {0x35, 0, 58, 0xffff0},
+ {0x35, 57, 55, 0xffff1},
+ {0x35, 0, 43, 0x182},
+ {0x35, 53, 55, 0xf0001},
+ {0x35, 0, 2, 0x16f},
+ {0x35, 0, 53, 0x17e},
+ {0x35, 52, 39, 0x180},
+ {0x35, 38, 51, 0x16e},
+ {0x35, 0, 5, 0x15b},
+ {0x35, 0, 2, 0x160},
+ {0x35, 0, 35, 0x161},
+ {0x35, 45, 47, 0x165},
+ {0x35, 0, 46, 0x15c},
+ {0x35, 45, 32, 0x15d},
+ {0x35, 0, 2, 0x152},
+ {0x35, 0, 30, 0x153},
+ {0x35, 40, 42, 0x15a},
+ {0x35, 41, 39, 0x151},
+ {0x35, 0, 10, 0x121},
+ {0x35, 0, 5, 0x138},
+ {0x35, 0, 2, 0x143},
+ {0x35, 0, 24, 0x147},
+ {0x35, 23, 34, 0x148},
+ {0x35, 0, 22, 0x139},
+ {0x35, 32, 34, 0x142},
+ {0x35, 0, 2, 0x127},
+ {0x35, 0, 30, 0x12a},
+ {0x35, 31, 18, 0x135},
+ {0x35, 30, 28, 0x126},
+ {0x35, 0, 4, 0x10e},
+ {0x35, 0, 2, 0x119},
+ {0x35, 0, 14, 0x11e},
+ {0x35, 137, 26, 0x120},
+ {0x35, 23, 25, 0x118},
+ {0x35, 0, 3, 0x10b},
+ {0x35, 0, 23, 0x10c},
+ {0x35, 9, 0, 0x10d},
+ {0x5, 0, 0, 0x110},
+ {0x35, 7, 20, 0x10a},
+ {0x35, 0, 25, 0xce},
+ {0x35, 0, 12, 0xee},
+ {0x35, 0, 6, 0xf9},
+ {0x35, 0, 2, 0x100},
+ {0x35, 0, 13, 0x101},
+ {0x35, 129, 14, 0x107},
+ {0x35, 1, 0, 0xfa},
+ {0x5, 0, 0, 0x10d},
+ {0x35, 11, 9, 0xfd},
+ {0x35, 0, 2, 0xf0},
+ {0x35, 0, 148, 0xf1},
+ {0x35, 6, 8, 0xf8},
+ {0x35, 7, 0, 0xef},
+ {0x5, 0, 0, 0x106},
+ {0x35, 0, 7, 0xda},
+ {0x35, 0, 3, 0xde},
+ {0x35, 0, 3, 0xe0},
+ {0x35, 2, 0, 0xe1},
+ {0x5, 0, 0, 0x103},
+ {0x35, 1, 0, 0xdc},
+ {0x5, 0, 0, 0x102},
+ {0x35, 209, 172, 0xdd},
+ {0x35, 0, 2, 0xd2},
+ {0x35, 0, 253, 0xd3},
+ {0x35, 252, 253, 0xd4},
+ {0x35, 252, 251, 0xd1},
+ {0x35, 0, 10, 0xb9},
+ {0x35, 0, 5, 0xc1},
+ {0x35, 0, 2, 0xc7},
+ {0x35, 0, 248, 0xcb},
+ {0x35, 247, 246, 0xcd},
+ {0x35, 0, 245, 0xc5},
+ {0x35, 244, 245, 0xc6},
+ {0x35, 0, 2, 0xbb},
+ {0x35, 0, 244, 0xbf},
+ {0x35, 162, 242, 0xc0},
+ {0x35, 241, 240, 0xba},
+ {0x35, 0, 4, 0xb2},
+ {0x35, 0, 2, 0xb5},
+ {0x35, 0, 239, 0xb6},
+ {0x35, 237, 236, 0xb8},
+ {0x35, 236, 237, 0xb4},
+ {0x35, 0, 2, 0xad},
+ {0x35, 0, 234, 0xb0},
+ {0x35, 233, 234, 0xb1},
+ {0x35, 156, 232, 0xac},
+ {0x35, 0, 42, 0x52},
+ {0x35, 0, 21, 0x7e},
+ {0x35, 0, 10, 0x96},
+ {0x35, 0, 5, 0xa4},
+ {0x35, 0, 2, 0xa8},
+ {0x35, 0, 226, 0xa9},
+ {0x35, 224, 226, 0xaa},
+ {0x35, 0, 223, 0xa5},
+ {0x35, 224, 223, 0xa6},
+ {0x35, 0, 2, 0x9e},
+ {0x35, 0, 221, 0x9f},
+ {0x35, 220, 221, 0xa2},
+ {0x35, 220, 219, 0x98},
+ {0x35, 0, 5, 0x8c},
+ {0x35, 0, 2, 0x90},
+ {0x35, 0, 217, 0x91},
+ {0x35, 216, 215, 0x94},
+ {0x35, 0, 214, 0x8d},
+ {0x35, 213, 212, 0x8e},
+ {0x35, 0, 2, 0x85},
+ {0x35, 0, 210, 0x86},
+ {0x35, 209, 211, 0x8a},
+ {0x35, 210, 209, 0x7f},
+ {0x35, 0, 10, 0x64},
+ {0x35, 0, 5, 0x73},
+ {0x35, 0, 2, 0x7a},
+ {0x35, 0, 205, 0x7b},
+ {0x35, 153, 205, 0x7d},
+ {0x35, 0, 204, 0x77},
+ {0x35, 203, 202, 0x79},
+ {0x35, 0, 2, 0x6c},
+ {0x35, 0, 200, 0x6d},
+ {0x35, 199, 200, 0x72},
+ {0x35, 197, 199, 0x6a},
+ {0x35, 0, 4, 0x5b},
+ {0x35, 0, 2, 0x60},
+ {0x35, 0, 195, 0x62},
+ {0x35, 193, 195, 0x63},
+ {0x35, 192, 193, 0x5c},
+ {0x35, 0, 2, 0x54},
+ {0x35, 0, 192, 0x55},
+ {0x35, 191, 189, 0x57},
+ {0x35, 188, 190, 0x53},
+ {0x35, 0, 21, 0x2d},
+ {0x35, 0, 10, 0x3e},
+ {0x35, 0, 5, 0x46},
+ {0x35, 0, 2, 0x4f},
+ {0x35, 0, 185, 0x50},
+ {0x35, 182, 183, 0x51},
+ {0x35, 0, 181, 0x48},
+ {0x35, 181, 182, 0x4e},
+ {0x35, 0, 2, 0x41},
+ {0x35, 0, 180, 0x43},
+ {0x35, 179, 178, 0x44},
+ {0x35, 177, 176, 0x3f},
+ {0x35, 0, 5, 0x33},
+ {0x35, 0, 2, 0x38},
+ {0x35, 0, 175, 0x3c},
+ {0x35, 174, 172, 0x3d},
+ {0x35, 0, 173, 0x36},
+ {0x35, 124, 171, 0x37},
+ {0x35, 0, 2, 0x2f},
+ {0x35, 0, 169, 0x30},
+ {0x35, 168, 169, 0x31},
+ {0x35, 166, 167, 0x2e},
+ {0x35, 0, 10, 0x17},
+ {0x35, 0, 5, 0x21},
+ {0x35, 0, 2, 0x26},
+ {0x35, 0, 162, 0x29},
+ {0x35, 163, 162, 0x2b},
+ {0x35, 0, 160, 0x22},
+ {0x35, 153, 161, 0x25},
+ {0x35, 0, 2, 0x19},
+ {0x35, 0, 159, 0x1d},
+ {0x35, 158, 157, 0x1e},
+ {0x35, 156, 155, 0x18},
+ {0x35, 0, 4, 0xd},
+ {0x35, 0, 2, 0x11},
+ {0x35, 0, 154, 0x13},
+ {0x35, 153, 152, 0x15},
+ {0x35, 150, 152, 0xe},
+ {0x35, 0, 2, 0x3},
+ {0x35, 0, 149, 0x7},
+ {0x35, 147, 149, 0x8},
+ {0x35, 146, 147, 0x2},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 140, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 143, 144, 0x1},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 136, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 139, 0, 0x1},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 132, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 135, 0, 0x6},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 128, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 131, 0, 0x2},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 124, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 127, 0, 0x0},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 120, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 123, 0, 0x5},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 116, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 119, 120, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 112, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 115, 0xfffffe7f},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 108, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 110, 0, 0x1},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 103, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 105, 0, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 98, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 100, 0, 0x4},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 93, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 95, 0, 0x5},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 88, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 90, 0, 0x9},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 83, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 85, 0, 0xa},
+ {0x6, 0, 0, 0x30005},
+ {0x20, 0, 0, 0x24},
+ {0x15, 0, 77, 0x0},
+ {0x20, 0, 0, 0x20},
+ {0x15, 80, 79, 0x4},
+ {0x20, 0, 0, 0x2c},
+ {0x15, 0, 73, 0x0},
+ {0x20, 0, 0, 0x28},
+ {0x45, 77, 76, 0xfffdb7cc},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 69, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 72, 0, 0x10},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 65, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 68, 0, 0xf},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 61, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 64, 0, 0x3},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 57, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 60, 0, 0x4},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 53, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 56, 0, 0x53564d41},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 49, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 52, 0, 0x29},
+ {0x6, 0, 0, 0x30004},
+ {0x20, 0, 0, 0x24},
+ {0x15, 0, 44, 0x0},
+ {0x20, 0, 0, 0x20},
+ {0x45, 48, 47, 0xfffffff8},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 40, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 43, 0, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 36, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 39, 0, 0x1},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 32, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 35, 0, 0x2},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 28, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 31, 0, 0x6},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 24, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 27, 0, 0x7},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 20, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 23, 0, 0x5},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 16, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 19, 0, 0x0},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 12, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 15, 0, 0x406},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 8, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 0, 12, 0x4},
+ {0x20, 0, 0, 0x24},
+ {0x15, 0, 4, 0x0},
+ {0x20, 0, 0, 0x20},
+ {0x45, 8, 7, 0xfff1e3fc},
+ {0x20, 0, 0, 0x14},
+ {0x15, 1, 0, 0x0},
+ {0x6, 0, 0, 0x30003},
+ {0x20, 0, 0, 0x10},
+ {0x15, 2, 0, 0x2da4},
+ {0x6, 0, 0, 0x30002},
+ {0x6, 0, 0, 0x50001},
+ {0x6, 0, 0, 0x7fff0000},
+ {0x6, 0, 0, 0x30001},
+};
+#elif defined(__aarch64__)
+// Note: aarch64 is not required to support seccomp-bpf yet, but some Nexus
+// devices do support it. For completeness, this test BPF program is provided.
+struct sock_filter kTestSeccompFilter[] = {
+ {0x20, 0, 0, 0x4},
+ {0x15, 1, 0, 0xc00000b7},
+ {0x6, 0, 0, 0x30006},
+ {0x20, 0, 0, 0x0},
+ {0x35, 0, 51, 0x88},
+ {0x35, 0, 25, 0xba},
+ {0x35, 0, 12, 0xdf},
+ {0x35, 0, 6, 0xea},
+ {0x35, 0, 3, 0x104},
+ {0x35, 0, 1, 0x114},
+ {0x35, 86, 85, 0x116},
+ {0x35, 85, 81, 0x105},
+ {0x35, 0, 84, 0xf2},
+ {0x35, 83, 82, 0xf3},
+ {0x35, 0, 2, 0xe4},
+ {0x35, 0, 77, 0xe6},
+ {0x35, 92, 80, 0xe9},
+ {0x35, 0, 79, 0xe2},
+ {0x35, 78, 97, 0xe3},
+ {0x35, 0, 6, 0xd1},
+ {0x35, 0, 3, 0xd9},
+ {0x35, 0, 1, 0xdd},
+ {0x35, 100, 73, 0xde},
+ {0x35, 69, 73, 0xdc},
+ {0x35, 0, 68, 0xd5},
+ {0x35, 67, 71, 0xd6},
+ {0x35, 0, 2, 0xcc},
+ {0x35, 0, 69, 0xce},
+ {0x35, 68, 64, 0xd0},
+ {0x35, 0, 66, 0xc7},
+ {0x35, 65, 99, 0xc8},
+ {0x35, 0, 12, 0x9e},
+ {0x35, 0, 6, 0xa6},
+ {0x35, 0, 3, 0xa9},
+ {0x35, 0, 1, 0xac},
+ {0x35, 61, 57, 0xb3},
+ {0x35, 60, 56, 0xaa},
+ {0x35, 0, 58, 0xa7},
+ {0x35, 58, 98, 0xa8},
+ {0x35, 0, 2, 0xa1},
+ {0x35, 0, 56, 0xa3},
+ {0x35, 55, 51, 0xa4},
+ {0x35, 0, 50, 0x9f},
+ {0x35, 49, 52, 0xa0},
+ {0x35, 0, 6, 0x94},
+ {0x35, 0, 3, 0x97},
+ {0x35, 0, 1, 0x9c},
+ {0x35, 49, 45, 0x9d},
+ {0x35, 48, 47, 0x99},
+ {0x35, 0, 43, 0x95},
+ {0x35, 42, 45, 0x96},
+ {0x35, 0, 2, 0x8b},
+ {0x35, 0, 40, 0x8e},
+ {0x35, 42, 43, 0x8f},
+ {0x35, 0, 42, 0x89},
+ {0x35, 41, 37, 0x8a},
+ {0x35, 0, 25, 0x4e},
+ {0x35, 0, 12, 0x65},
+ {0x35, 0, 6, 0x80},
+ {0x35, 0, 3, 0x83},
+ {0x35, 0, 1, 0x85},
+ {0x35, 31, 35, 0x86},
+ {0x35, 30, 117, 0x84},
+ {0x35, 0, 29, 0x81},
+ {0x35, 122, 115, 0x82},
+ {0x35, 0, 2, 0x72},
+ {0x35, 0, 30, 0x7c},
+ {0x35, 29, 25, 0x7d},
+ {0x35, 0, 24, 0x66},
+ {0x35, 118, 27, 0x71},
+ {0x35, 0, 6, 0x5b},
+ {0x35, 0, 3, 0x61},
+ {0x35, 0, 1, 0x63},
+ {0x35, 23, 22, 0x64},
+ {0x35, 155, 22, 0x62},
+ {0x35, 0, 20, 0x5c},
+ {0x35, 16, 20, 0x5d},
+ {0x35, 0, 2, 0x58},
+ {0x35, 0, 17, 0x59},
+ {0x35, 13, 17, 0x5a},
+ {0x35, 0, 15, 0x4f},
+ {0x35, 15, 11, 0x51},
+ {0x35, 0, 15, 0x2c},
+ {0x35, 0, 6, 0x3b},
+ {0x35, 0, 3, 0x3e},
+ {0x35, 0, 1, 0x48},
+ {0x35, 10, 6, 0x4a},
+ {0x35, 9, 5, 0x44},
+ {0x35, 0, 4, 0x3c},
+ {0x35, 6, 7, 0x3d},
+ {0x35, 0, 3, 0x34},
+ {0x35, 0, 4, 0x38},
+ {0x35, 4, 0, 0x3a},
+ {0x5, 0, 0, 0x104},
+ {0x35, 0, 2, 0x2d},
+ {0x35, 1, 0, 0x33},
+ {0x5, 0, 0, 0x102},
+ {0x5, 0, 0, 0x102},
+ {0x35, 0, 5, 0x1d},
+ {0x35, 0, 2, 0x21},
+ {0x35, 0, 254, 0x27},
+ {0x35, 253, 254, 0x2b},
+ {0x35, 0, 251, 0x1e},
+ {0x35, 250, 252, 0x20},
+ {0x35, 0, 2, 0x14},
+ {0x35, 0, 248, 0x19},
+ {0x35, 249, 179, 0x1a},
+ {0x35, 0, 248, 0x11},
+ {0x35, 247, 246, 0x13},
+ {0x20, 0, 0, 0x24},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 235, 0xffffffff},
+ {0x20, 0, 0, 0x20},
+ {0x45, 0, 233, 0x80000000},
+ {0x20, 0, 0, 0x20},
+ {0x15, 238, 239, 0x4},
+ {0x20, 0, 0, 0x24},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 228, 0xffffffff},
+ {0x20, 0, 0, 0x20},
+ {0x45, 0, 226, 0x80000000},
+ {0x20, 0, 0, 0x20},
+ {0x45, 233, 231, 0xfffffff8},
+ {0x20, 0, 0, 0x2c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 221, 0xffffffff},
+ {0x20, 0, 0, 0x28},
+ {0x45, 0, 219, 0x80000000},
+ {0x20, 0, 0, 0x28},
+ {0x45, 226, 224, 0xfffdb7cc},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 214, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 212, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 217, 219, 0x1},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 207, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 205, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 210, 0, 0x10},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 200, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 198, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 203, 0, 0xf},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 193, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 191, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 196, 0, 0x3},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 186, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 184, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 189, 0, 0x4},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 179, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 177, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 182, 0, 0x53564d41},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 172, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 170, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 175, 0, 0x29},
+ {0x6, 0, 0, 0x30005},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 164, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 162, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 167, 0, 0x1393},
+ {0x6, 0, 0, 0x30004},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 156, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 154, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 159, 0, 0x1},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 149, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 147, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 152, 0, 0x6},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 142, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 140, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 145, 0, 0x2},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 135, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 133, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 138, 0, 0x0},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 128, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 126, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 131, 0, 0x5},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 121, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 119, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 124, 126, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 114, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 112, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 117, 0xfffffe7f},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 107, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 105, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 109, 0, 0x1},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 99, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 97, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 101, 0, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 91, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 89, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 93, 0, 0x4},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 83, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 81, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 85, 0, 0x5},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 75, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 73, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 77, 0, 0x9},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 67, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 65, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 69, 0, 0xa},
+ {0x6, 0, 0, 0x30003},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 58, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 56, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 61, 0, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 51, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 49, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 54, 0, 0x1},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 44, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 42, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 47, 0, 0x2},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 37, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 35, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 40, 0, 0x6},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 30, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 28, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 33, 0, 0x7},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 23, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 21, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 26, 0, 0x5},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 16, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 14, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 19, 0, 0x0},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 9, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 7, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 12, 0, 0x406},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 4, 0, 0x0},
+ {0x15, 0, 2, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 1, 0, 0x80000000},
+ {0x6, 0, 0, 0x30002},
+ {0x20, 0, 0, 0x18},
+ {0x15, 0, 6, 0x4},
+ {0x20, 0, 0, 0x24},
+ {0x15, 0, 4, 0x0},
+ {0x20, 0, 0, 0x20},
+ {0x45, 2, 0, 0xffe1e3fc},
+ {0x6, 0, 0, 0x7fff0000},
+ {0x6, 0, 0, 0x50001},
+ {0x6, 0, 0, 0x30001},
+};
+#elif defined(__i386__)
+struct sock_filter kTestSeccompFilter[] = {
+ {0x20, 0, 0, 0x4},
+ {0x15, 1, 0, 0x40000003},
+ {0x6, 0, 0, 0x30007},
+ {0x20, 0, 0, 0x0},
+ {0x45, 0, 1, 0x40000000},
+ {0x6, 0, 0, 0x30006},
+ {0x35, 0, 87, 0x94},
+ {0x35, 0, 43, 0xdd},
+ {0x35, 0, 20, 0x11c},
+ {0x35, 0, 10, 0x13f},
+ {0x35, 0, 5, 0x149},
+ {0x35, 0, 2, 0x163},
+ {0x35, 0, 79, 0x164},
+ {0x35, 78, 73, 0x165},
+ {0x35, 0, 78, 0x14c},
+ {0x35, 71, 76, 0x161},
+ {0x35, 0, 2, 0x141},
+ {0x35, 0, 74, 0x144},
+ {0x35, 73, 68, 0x145},
+ {0x35, 67, 73, 0x140},
+ {0x35, 0, 4, 0x12d},
+ {0x35, 0, 2, 0x136},
+ {0x35, 0, 69, 0x137},
+ {0x35, 68, 63, 0x138},
+ {0x35, 68, 62, 0x134},
+ {0x35, 0, 2, 0x127},
+ {0x35, 0, 66, 0x128},
+ {0x35, 65, 59, 0x12c},
+ {0x35, 63, 64, 0x11d},
+ {0x35, 0, 11, 0xfe},
+ {0x35, 0, 6, 0x10a},
+ {0x35, 0, 3, 0x10e},
+ {0x35, 1, 0, 0x10f},
+ {0x5, 0, 0, 0x135},
+ {0x35, 57, 52, 0x110},
+ {0x35, 0, 56, 0x10c},
+ {0x35, 55, 50, 0x10d},
+ {0x35, 0, 2, 0x102},
+ {0x35, 0, 54, 0x103},
+ {0x35, 135, 52, 0x109},
+ {0x35, 51, 52, 0x101},
+ {0x35, 0, 4, 0xef},
+ {0x35, 0, 2, 0xf1},
+ {0x35, 0, 48, 0xfc},
+ {0x35, 42, 48, 0xfd},
+ {0x35, 153, 46, 0xf0},
+ {0x35, 0, 3, 0xe0},
+ {0x35, 0, 45, 0xe1},
+ {0x35, 0, 43, 0xee},
+ {0x5, 0, 0, 0x12a},
+ {0x35, 41, 252, 0xde},
+ {0x35, 0, 20, 0xb6},
+ {0x35, 0, 10, 0xc7},
+ {0x35, 0, 5, 0xd2},
+ {0x35, 0, 2, 0xd9},
+ {0x35, 0, 36, 0xdb},
+ {0x35, 30, 177, 0xdc},
+ {0x35, 0, 29, 0xd3},
+ {0x35, 28, 34, 0xd4},
+ {0x35, 0, 2, 0xcd},
+ {0x35, 0, 32, 0xce},
+ {0x35, 31, 25, 0xd1},
+ {0x35, 24, 30, 0xcb},
+ {0x35, 0, 4, 0xbf},
+ {0x35, 0, 2, 0xc1},
+ {0x35, 0, 21, 0xc5},
+ {0x35, 20, 26, 0xc6},
+ {0x35, 231, 25, 0xc0},
+ {0x35, 0, 2, 0xb9},
+ {0x35, 0, 17, 0xba},
+ {0x35, 21, 22, 0xbb},
+ {0x35, 21, 15, 0xb8},
+ {0x35, 0, 9, 0xa9},
+ {0x35, 0, 4, 0xb0},
+ {0x35, 0, 2, 0xb2},
+ {0x35, 0, 16, 0xb4},
+ {0x35, 15, 16, 0xb5},
+ {0x35, 15, 14, 0xb1},
+ {0x35, 0, 2, 0xab},
+ {0x35, 0, 13, 0xac},
+ {0x35, 12, 157, 0xad},
+ {0x35, 5, 10, 0xaa},
+ {0x35, 0, 5, 0xa2},
+ {0x35, 0, 2, 0xa5},
+ {0x35, 0, 8, 0xa6},
+ {0x35, 7, 6, 0xa8},
+ {0x35, 0, 6, 0xa4},
+ {0x5, 0, 0, 0x105},
+ {0x35, 0, 2, 0x98},
+ {0x35, 0, 2, 0x9e},
+ {0x35, 1, 2, 0x9f},
+ {0x35, 1, 0, 0x96},
+ {0x5, 0, 0, 0x102},
+ {0x5, 0, 0, 0x100},
+ {0x35, 0, 40, 0x4f},
+ {0x35, 0, 20, 0x6e},
+ {0x35, 0, 10, 0x7d},
+ {0x35, 0, 5, 0x8a},
+ {0x35, 0, 2, 0x8e},
+ {0x35, 0, 250, 0x90},
+ {0x35, 249, 250, 0x91},
+ {0x35, 0, 247, 0x8c},
+ {0x35, 246, 247, 0x8d},
+ {0x35, 0, 2, 0x7f},
+ {0x35, 0, 246, 0x85},
+ {0x35, 245, 243, 0x86},
+ {0x35, 243, 156, 0x7e},
+ {0x35, 0, 4, 0x76},
+ {0x35, 0, 2, 0x79},
+ {0x35, 0, 241, 0x7a},
+ {0x35, 240, 239, 0x7b},
+ {0x35, 238, 239, 0x77},
+ {0x35, 0, 2, 0x72},
+ {0x35, 0, 236, 0x73},
+ {0x35, 234, 236, 0x75},
+ {0x35, 235, 233, 0x6f},
+ {0x35, 0, 9, 0x60},
+ {0x35, 0, 4, 0x66},
+ {0x35, 0, 2, 0x6a},
+ {0x35, 0, 229, 0x6c},
+ {0x35, 230, 229, 0x6d},
+ {0x35, 229, 145, 0x67},
+ {0x35, 0, 2, 0x63},
+ {0x35, 0, 225, 0x64},
+ {0x35, 224, 226, 0x65},
+ {0x35, 225, 224, 0x62},
+ {0x35, 0, 4, 0x57},
+ {0x35, 0, 2, 0x5a},
+ {0x35, 0, 170, 0x5b},
+ {0x35, 219, 220, 0x5c},
+ {0x35, 218, 220, 0x59},
+ {0x35, 0, 2, 0x51},
+ {0x35, 0, 216, 0x52},
+ {0x35, 215, 216, 0x53},
+ {0x35, 215, 216, 0x50},
+ {0x35, 0, 20, 0x29},
+ {0x35, 0, 10, 0x38},
+ {0x35, 0, 5, 0x41},
+ {0x35, 0, 2, 0x46},
+ {0x35, 0, 209, 0x48},
+ {0x35, 209, 210, 0x4e},
+ {0x35, 0, 209, 0x43},
+ {0x35, 208, 207, 0x44},
+ {0x35, 0, 2, 0x3d},
+ {0x35, 0, 206, 0x3e},
+ {0x35, 204, 203, 0x3f},
+ {0x35, 202, 204, 0x3c},
+ {0x35, 0, 4, 0x30},
+ {0x35, 0, 2, 0x33},
+ {0x35, 0, 201, 0x36},
+ {0x35, 152, 199, 0x37},
+ {0x35, 198, 199, 0x31},
+ {0x35, 0, 2, 0x2d},
+ {0x35, 0, 196, 0x2e},
+ {0x35, 195, 194, 0x2f},
+ {0x35, 195, 194, 0x2b},
+ {0x35, 0, 9, 0x17},
+ {0x35, 0, 4, 0x1f},
+ {0x35, 0, 2, 0x22},
+ {0x35, 0, 191, 0x25},
+ {0x35, 188, 182, 0x26},
+ {0x35, 187, 189, 0x21},
+ {0x35, 0, 2, 0x19},
+ {0x35, 0, 187, 0x1d},
+ {0x35, 184, 185, 0x1e},
+ {0x35, 184, 183, 0x18},
+ {0x35, 0, 4, 0xe},
+ {0x35, 0, 2, 0x12},
+ {0x35, 0, 180, 0x13},
+ {0x35, 181, 180, 0x15},
+ {0x35, 180, 178, 0x11},
+ {0x35, 0, 2, 0x3},
+ {0x35, 0, 177, 0x8},
+ {0x35, 176, 175, 0xd},
+ {0x35, 174, 175, 0x2},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 168, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 171, 0, 0x1},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 164, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 167, 0, 0x6},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 160, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 163, 0, 0x2},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 156, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 159, 0, 0x0},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 152, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 155, 0, 0x5},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 148, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 151, 152, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 144, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 147, 0xfffffe7f},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 140, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 142, 0, 0x1},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 135, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 137, 0, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 130, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 132, 0, 0x4},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 125, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 127, 0, 0x5},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 120, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 122, 0, 0x9},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 115, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 117, 0, 0xa},
+ {0x6, 0, 0, 0x30005},
+ {0x20, 0, 0, 0x24},
+ {0x15, 0, 109, 0x0},
+ {0x20, 0, 0, 0x20},
+ {0x15, 112, 111, 0x4},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 105, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 108, 0, 0x10},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 101, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 104, 0, 0xf},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 97, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 100, 0, 0x3},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 93, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 96, 0, 0x4},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 89, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 92, 0, 0x53564d41},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 85, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 88, 0, 0x29},
+ {0x6, 0, 0, 0x30004},
+ {0x20, 0, 0, 0x24},
+ {0x15, 0, 80, 0x0},
+ {0x20, 0, 0, 0x20},
+ {0x45, 84, 83, 0xfffffff8},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 76, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 79, 0, 0x8},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 72, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 75, 0, 0xd},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 68, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 71, 0, 0xa},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 64, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 67, 0, 0x9},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 60, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 63, 0, 0xc},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 56, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 59, 0, 0xb},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 52, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 55, 0, 0x11},
+ {0x20, 0, 0, 0x14},
+ {0x15, 0, 48, 0x0},
+ {0x20, 0, 0, 0x10},
+ {0x15, 51, 50, 0x10},
+ {0x20, 0, 0, 0x2c},
+ {0x15, 0, 44, 0x0},
+ {0x20, 0, 0, 0x28},
+ {0x45, 48, 47, 0xfffdb7cc},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 40, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 43, 0, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 36, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 39, 0, 0x1},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 32, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 35, 0, 0x2},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 28, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 31, 0, 0x6},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 24, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 27, 0, 0x7},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 20, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 23, 0, 0x5},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 16, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 19, 0, 0x0},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 12, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 15, 0, 0x406},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 0, 8, 0x0},
+ {0x20, 0, 0, 0x18},
+ {0x15, 0, 12, 0x4},
+ {0x20, 0, 0, 0x24},
+ {0x15, 0, 4, 0x0},
+ {0x20, 0, 0, 0x20},
+ {0x45, 8, 7, 0xfff363fc},
+ {0x20, 0, 0, 0x14},
+ {0x15, 1, 0, 0x0},
+ {0x6, 0, 0, 0x30003},
+ {0x20, 0, 0, 0x10},
+ {0x15, 2, 0, 0x9d0},
+ {0x6, 0, 0, 0x30002},
+ {0x6, 0, 0, 0x50001},
+ {0x6, 0, 0, 0x7fff0000},
+ {0x6, 0, 0, 0x30001},
+};
+#elif defined(__x86_64__)
+struct sock_filter kTestSeccompFilter[] = {
+ {0x20, 0, 0, 0x4},
+ {0x15, 1, 0, 0xc000003e},
+ {0x6, 0, 0, 0x30007},
+ {0x20, 0, 0, 0x0},
+ {0x45, 0, 1, 0x40000000},
+ {0x6, 0, 0, 0x30006},
+ {0x35, 0, 59, 0x7f},
+ {0x35, 0, 29, 0xe4},
+ {0x35, 0, 14, 0x111},
+ {0x35, 0, 7, 0x120},
+ {0x35, 0, 3, 0x13c},
+ {0x35, 0, 1, 0x13f},
+ {0x35, 102, 95, 0x140},
+ {0x35, 101, 94, 0x13e},
+ {0x35, 0, 1, 0x123},
+ {0x35, 99, 94, 0x126},
+ {0x35, 98, 91, 0x121},
+ {0x35, 0, 3, 0x119},
+ {0x35, 0, 1, 0x11d},
+ {0x35, 95, 88, 0x11e},
+ {0x35, 94, 89, 0x11a},
+ {0x35, 0, 86, 0x112},
+ {0x35, 85, 92, 0x118},
+ {0x35, 0, 6, 0xf8},
+ {0x35, 0, 3, 0x106},
+ {0x35, 0, 1, 0x10e},
+ {0x35, 88, 83, 0x110},
+ {0x35, 80, 82, 0x107},
+ {0x35, 0, 86, 0x101},
+ {0x35, 78, 80, 0x102},
+ {0x35, 0, 4, 0xea},
+ {0x35, 0, 1, 0xec},
+ {0x35, 77, 82, 0xf7},
+ {0x35, 74, 0, 0xeb},
+ {0x5, 0, 0, 0x12a},
+ {0x35, 0, 89, 0xe5},
+ {0x35, 73, 78, 0xe7},
+ {0x35, 0, 15, 0xac},
+ {0x35, 0, 7, 0xcb},
+ {0x35, 0, 3, 0xd9},
+ {0x35, 0, 1, 0xdc},
+ {0x35, 73, 66, 0xdd},
+ {0x35, 67, 65, 0xda},
+ {0x35, 0, 1, 0xd5},
+ {0x35, 70, 65, 0xd6},
+ {0x35, 62, 69, 0xd4},
+ {0x35, 0, 4, 0xbb},
+ {0x35, 0, 1, 0xc9},
+ {0x35, 118, 61, 0xca},
+ {0x35, 0, 65, 0xc8},
+ {0x5, 0, 0, 0x121},
+ {0x35, 0, 56, 0xae},
+ {0x35, 57, 62, 0xba},
+ {0x35, 0, 6, 0x8a},
+ {0x35, 0, 3, 0x95},
+ {0x35, 0, 1, 0x9d},
+ {0x35, 58, 166, 0x9e},
+ {0x35, 57, 52, 0x97},
+ {0x35, 0, 56, 0x8c},
+ {0x35, 55, 50, 0x8e},
+ {0x35, 0, 3, 0x83},
+ {0x35, 0, 1, 0x87},
+ {0x35, 45, 52, 0x88},
+ {0x35, 44, 46, 0x84},
+ {0x35, 0, 50, 0x80},
+ {0x35, 49, 44, 0x81},
+ {0x35, 0, 28, 0x3b},
+ {0x35, 0, 14, 0x69},
+ {0x35, 0, 7, 0x74},
+ {0x35, 0, 3, 0x79},
+ {0x35, 0, 1, 0x7c},
+ {0x35, 36, 38, 0x7e},
+ {0x35, 35, 42, 0x7a},
+ {0x35, 0, 1, 0x77},
+ {0x35, 35, 33, 0x78},
+ {0x35, 34, 32, 0x76},
+ {0x35, 0, 3, 0x6e},
+ {0x35, 0, 1, 0x71},
+ {0x35, 31, 29, 0x73},
+ {0x35, 35, 30, 0x6f},
+ {0x35, 0, 27, 0x6b},
+ {0x35, 33, 28, 0x6d},
+ {0x35, 0, 6, 0x4a},
+ {0x35, 0, 3, 0x62},
+ {0x35, 0, 1, 0x67},
+ {0x35, 24, 29, 0x68},
+ {0x35, 23, 28, 0x66},
+ {0x35, 0, 27, 0x4c},
+ {0x35, 21, 19, 0x60},
+ {0x35, 0, 3, 0x3f},
+ {0x35, 0, 1, 0x48},
+ {0x35, 18, 174, 0x49},
+ {0x35, 15, 17, 0x40},
+ {0x35, 0, 14, 0x3c},
+ {0x35, 238, 15, 0x3e},
+ {0x35, 0, 15, 0x1d},
+ {0x35, 0, 6, 0x31},
+ {0x35, 0, 3, 0x36},
+ {0x35, 0, 1, 0x39},
+ {0x35, 15, 8, 0x3a},
+ {0x35, 9, 14, 0x37},
+ {0x35, 0, 6, 0x33},
+ {0x35, 238, 12, 0x35},
+ {0x35, 0, 3, 0x27},
+ {0x35, 0, 1, 0x29},
+ {0x35, 4, 2, 0x2c},
+ {0x35, 8, 3, 0x28},
+ {0x35, 1, 0, 0x20},
+ {0x5, 0, 0, 0x105},
+ {0x35, 5, 0, 0x24},
+ {0x5, 0, 0, 0x104},
+ {0x35, 0, 7, 0xb},
+ {0x35, 0, 4, 0x15},
+ {0x35, 0, 2, 0x1a},
+ {0x35, 233, 0, 0x1c},
+ {0x5, 0, 0, 0x100},
+ {0x35, 254, 253, 0x16},
+ {0x35, 0, 253, 0x12},
+ {0x35, 252, 253, 0x13},
+ {0x35, 0, 3, 0x6},
+ {0x35, 0, 1, 0x9},
+ {0x35, 233, 240, 0xa},
+ {0x35, 248, 247, 0x7},
+ {0x35, 0, 247, 0x4},
+ {0x35, 246, 245, 0x5},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 239, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 237, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 239, 0, 0x1},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 232, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 230, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 232, 0, 0x6},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 225, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 223, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 225, 0, 0x2},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 218, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 216, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 218, 0, 0x0},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 211, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 209, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 211, 0, 0x5},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 204, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 202, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 204, 205, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 197, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 195, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 197, 0xfffffe7f},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 190, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 188, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 189, 0, 0x1},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 182, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 180, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 181, 0, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 174, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 172, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 173, 0, 0x4},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 166, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 164, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 165, 0, 0x5},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 158, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 156, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 157, 0, 0x9},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 150, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 148, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x54, 0, 0, 0xfffffe7f},
+ {0x15, 149, 0, 0xa},
+ {0x6, 0, 0, 0x30005},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 141, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 139, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 141, 0, 0x10},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 134, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 132, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 134, 0, 0xf},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 127, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 125, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 127, 0, 0x3},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 120, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 118, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 120, 0, 0x4},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 113, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 111, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 113, 0, 0x53564d41},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 106, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 104, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 106, 0, 0x29},
+ {0x6, 0, 0, 0x30004},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 98, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 96, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 98, 0, 0x3},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 91, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 89, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 91, 0, 0x1},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 84, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 82, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 84, 0, 0x2},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 77, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 75, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 77, 0, 0x6},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 70, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 68, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 70, 0, 0x7},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 63, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 61, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 63, 0, 0x5},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 56, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 54, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 56, 0, 0x0},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 49, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 47, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 49, 0, 0x406},
+ {0x20, 0, 0, 0x1c},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 42, 0xffffffff},
+ {0x20, 0, 0, 0x18},
+ {0x45, 0, 40, 0x80000000},
+ {0x20, 0, 0, 0x18},
+ {0x15, 0, 43, 0x4},
+ {0x20, 0, 0, 0x24},
+ {0x15, 0, 41, 0x0},
+ {0x20, 0, 0, 0x20},
+ {0x45, 39, 38, 0xffe363fc},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 31, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 29, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 31, 0, 0xa57},
+ {0x6, 0, 0, 0x30003},
+ {0x20, 0, 0, 0x14},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 23, 0xffffffff},
+ {0x20, 0, 0, 0x10},
+ {0x45, 0, 21, 0x80000000},
+ {0x20, 0, 0, 0x10},
+ {0x15, 23, 24, 0x1},
+ {0x20, 0, 0, 0x24},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 16, 0xffffffff},
+ {0x20, 0, 0, 0x20},
+ {0x45, 0, 14, 0x80000000},
+ {0x20, 0, 0, 0x20},
+ {0x15, 16, 15, 0x4},
+ {0x20, 0, 0, 0x24},
+ {0x15, 3, 0, 0x0},
+ {0x15, 0, 9, 0xffffffff},
+ {0x20, 0, 0, 0x20},
+ {0x45, 0, 7, 0x80000000},
+ {0x20, 0, 0, 0x20},
+ {0x45, 10, 9, 0xfffffff8},
+ {0x20, 0, 0, 0x2c},
+ {0x15, 4, 0, 0x0},
+ {0x15, 0, 2, 0xffffffff},
+ {0x20, 0, 0, 0x28},
+ {0x45, 1, 0, 0x80000000},
+ {0x6, 0, 0, 0x30002},
+ {0x20, 0, 0, 0x28},
+ {0x45, 2, 1, 0xfffdb7cc},
+ {0x6, 0, 0, 0x50001},
+ {0x6, 0, 0, 0x7fff0000},
+ {0x6, 0, 0, 0x30001},
+};
+#endif
+
+struct sock_fprog GetTestSeccompFilterProgram() {
+ struct sock_fprog prog = {
+ .len = sizeof(kTestSeccompFilter) / sizeof(struct sock_filter),
+ .filter = kTestSeccompFilter
+ };
+ return prog;
+}
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tests/tests/os/jni/seccomp_sample_program.h
new file mode 100644
index 0000000..1293572
--- /dev/null
+++ b/tests/tests/os/jni/seccomp_sample_program.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#include <linux/filter.h>
+
+struct sock_fprog GetTestSeccompFilterProgram();
diff --git a/tests/tests/os/src/android/os/cts/ISeccompIsolatedService.aidl b/tests/tests/os/src/android/os/cts/ISeccompIsolatedService.aidl
new file mode 100644
index 0000000..5234eff
--- /dev/null
+++ b/tests/tests/os/src/android/os/cts/ISeccompIsolatedService.aidl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2015 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.os.cts;
+
+import android.os.IBinder;
+import android.os.ParcelFileDescriptor;
+
+interface ISeccompIsolatedService {
+ boolean installFilter();
+
+ boolean createThread();
+
+ boolean getSystemInfo();
+
+ boolean writeToFile(in ParcelFileDescriptor fd);
+
+ boolean openAshmem();
+
+ boolean openDevFile();
+
+ void violatePolicy();
+}
diff --git a/tests/tests/os/src/android/os/cts/SeccompTest.java b/tests/tests/os/src/android/os/cts/SeccompTest.java
index e8de783..4c2f78f 100644
--- a/tests/tests/os/src/android/os/cts/SeccompTest.java
+++ b/tests/tests/os/src/android/os/cts/SeccompTest.java
@@ -16,9 +16,36 @@
package android.os.cts;
-import junit.framework.TestCase;
+import android.app.Service;
+import android.content.Context;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Environment;
+import android.os.IBinder;
+import android.os.ParcelFileDescriptor;
+import android.os.RemoteException;
+import android.os.MemoryFile;
+import android.os.SystemClock;
+import android.os.Build;
+import android.util.Log;
+import android.test.AndroidTestCase;
-public class SeccompTest extends TestCase {
+import com.google.common.util.concurrent.AbstractFuture;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.Date;
+
+public class SeccompTest extends AndroidTestCase {
+ final static String TAG = "SeccompTest";
+
static {
System.loadLibrary("ctsos_jni");
}
@@ -142,7 +169,218 @@
}
/**
+ * Integration test for seccomp-bpf policy applied to an isolatedProcess=true
+ * service. This will perform various operations in an isolated process under a
+ * fairly restrictive seccomp policy.
+ */
+ public void testIsolatedServicePolicy() throws InterruptedException, ExecutionException,
+ RemoteException {
+ if (!OSFeatures.needsSeccompSupport())
+ return;
+
+ final IsolatedServiceConnection peer = new IsolatedServiceConnection();
+ final Intent intent = new Intent(getContext(), IsolatedService.class);
+ assertTrue(getContext().bindService(intent, peer, Context.BIND_AUTO_CREATE));
+
+ final ISeccompIsolatedService service = peer.get();
+
+ // installFilter() must be called first, to set the seccomp policy.
+ assertTrue(service.installFilter());
+ assertTrue(service.createThread());
+ assertTrue(service.getSystemInfo());
+ doFileWriteTest(service);
+ assertTrue(service.openAshmem());
+ assertTrue(service.openDevFile());
+
+ getContext().unbindService(peer);
+ }
+
+ /**
+ * Integration test for seccomp-bpf policy with isolatedProcess, where the
+ * process then violates the policy and gets killed by the kernel.
+ */
+ public void testViolateIsolatedServicePolicy() throws InterruptedException,
+ ExecutionException, RemoteException {
+ if (!OSFeatures.needsSeccompSupport())
+ return;
+
+ final IsolatedServiceConnection peer = new IsolatedServiceConnection();
+ final Intent intent = new Intent(getContext(), IsolatedService.class);
+ assertTrue(getContext().bindService(intent, peer, Context.BIND_AUTO_CREATE));
+
+ final ISeccompIsolatedService service = peer.get();
+
+ assertTrue(service.installFilter());
+ boolean gotRemoteException = false;
+ try {
+ service.violatePolicy();
+ } catch (RemoteException e) {
+ gotRemoteException = true;
+ }
+ assertTrue(gotRemoteException);
+
+ getContext().unbindService(peer);
+ }
+
+ private void doFileWriteTest(ISeccompIsolatedService service) throws RemoteException {
+ final String fileName = "seccomp_test";
+ ParcelFileDescriptor fd = null;
+ try {
+ FileOutputStream fOut = getContext().openFileOutput(fileName, 0);
+ fd = ParcelFileDescriptor.dup(fOut.getFD());
+ fOut.close();
+ } catch (FileNotFoundException e) {
+ fail(e.getMessage());
+ return;
+ } catch (IOException e) {
+ fail(e.getMessage());
+ return;
+ }
+
+ assertTrue(service.writeToFile(fd));
+
+ try {
+ FileInputStream fIn = getContext().openFileInput(fileName);
+ assertEquals('!', fIn.read());
+ fIn.close();
+ } catch (FileNotFoundException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ class IsolatedServiceConnection extends AbstractFuture<ISeccompIsolatedService>
+ implements ServiceConnection {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ set(ISeccompIsolatedService.Stub.asInterface(service));
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ }
+
+ @Override
+ public ISeccompIsolatedService get() throws InterruptedException, ExecutionException {
+ try {
+ return get(10, TimeUnit.SECONDS);
+ } catch (TimeoutException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ public static class IsolatedService extends Service {
+ private final ISeccompIsolatedService.Stub mService = new ISeccompIsolatedService.Stub() {
+ public boolean installFilter() {
+ return installTestFilter();
+ }
+
+ public boolean createThread() {
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ }
+ }
+ });
+ thread.run();
+ try {
+ thread.join();
+ } catch (InterruptedException e) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean getSystemInfo() {
+ long uptimeMillis = SystemClock.uptimeMillis();
+ if (uptimeMillis < 1) {
+ Log.d(TAG, "SystemClock failed");
+ return false;
+ }
+
+ String version = Build.VERSION.CODENAME;
+ if (version.length() == 0) {
+ Log.d(TAG, "Build.VERSION failed");
+ return false;
+ }
+
+ long time = (new Date()).getTime();
+ if (time < 100) {
+ Log.d(TAG, "getTime failed");
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean writeToFile(ParcelFileDescriptor fd) {
+ FileOutputStream fOut = new FileOutputStream(fd.getFileDescriptor());
+ try {
+ fOut.write('!');
+ fOut.close();
+ } catch (IOException e) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean openAshmem() {
+ byte[] buffer = {'h', 'e', 'l', 'l', 'o'};
+ try {
+ MemoryFile file = new MemoryFile("seccomp_isolated_test", 32);
+ file.writeBytes(buffer, 0, 0, buffer.length);
+ file.close();
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
+ public boolean openDevFile() {
+ try {
+ FileInputStream fIn = new FileInputStream("/dev/zero");
+ boolean succeed = fIn.read() == 0;
+ succeed &= fIn.read() == 0;
+ succeed &= fIn.read() == 0;
+ fIn.close();
+ return succeed;
+ } catch (FileNotFoundException e) {
+ return false;
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
+ public void violatePolicy() {
+ getClockBootTime();
+ }
+ };
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return mService;
+ }
+ }
+
+ /**
* Runs the seccomp_bpf_unittest of the given name.
*/
private native boolean runKernelUnitTest(final String name);
+
+ /**
+ * Installs a test seccomp-bpf filter program that.
+ */
+ private native static boolean installTestFilter();
+
+ /**
+ * Attempts to get the CLOCK_BOOTTIME, which is a violation of the
+ * policy specified by installTestFilter().
+ */
+ private native static int getClockBootTime();
}
diff --git a/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java b/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
index fb62f26..c862cc3 100644
--- a/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
+++ b/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
@@ -282,7 +282,7 @@
extras.putInt(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, videoState);
}
- mTelecomManager.placeCall(getTestNumber(), extras);
+ mTelecomManager.placeCall(createTestNumber(), extras);
}
/**
@@ -290,8 +290,12 @@
* calls if multiple calls to the same number are placed within a short period of time which
* can cause certain tests to fail.
*/
- Uri getTestNumber() {
- return Uri.fromParts("tel", String.valueOf(sCounter++), null);
+ Uri createTestNumber() {
+ return Uri.fromParts("tel", String.valueOf(++sCounter), null);
+ }
+
+ public static Uri getTestNumber() {
+ return Uri.fromParts("tel", String.valueOf(sCounter), null);
}
void assertNumCalls(final MockInCallService inCallService, final int numCalls) {
diff --git a/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java b/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java
new file mode 100644
index 0000000..e333868
--- /dev/null
+++ b/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2015 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.telecom.cts;
+
+import static android.telecom.cts.TestUtils.*;
+
+import android.graphics.drawable.Icon;
+import android.os.Bundle;
+import android.net.Uri;
+import android.telecom.Call;
+import android.telecom.Connection;
+import android.telecom.ConnectionRequest;
+import android.telecom.DisconnectCause;
+import android.telecom.GatewayInfo;
+import android.telecom.InCallService;
+import android.telecom.PhoneAccount;
+import android.telecom.PhoneAccountHandle;
+import android.telecom.StatusHints;
+import android.telecom.TelecomManager;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Suites of tests that verifies the various Call details.
+ */
+public class CallDetailsTest extends BaseTelecomTestWithMockServices {
+
+ public static final int CONNECTION_CAPABILITIES =
+ Connection.CAPABILITY_HOLD | Connection.CAPABILITY_MUTE |
+ /**
+ * CAPABILITY_HIGH_DEF_AUDIO & CAPABILITY_WIFI are hidden, so
+ * hardcoding the values for now.
+ */
+ 0x00008000 | 0x00010000;
+ public static final int CALL_CAPABILITIES =
+ Call.Details.CAPABILITY_HOLD | Call.Details.CAPABILITY_MUTE;
+ public static final int CALL_PROPERTIES =
+ Call.Details.PROPERTY_HIGH_DEF_AUDIO | Call.Details.PROPERTY_WIFI;
+ public static final String CALLER_DISPLAY_NAME = "CTS test";
+ public static final int CALLER_DISPLAY_NAME_PRESENTATION = TelecomManager.PRESENTATION_ALLOWED;
+
+ private StatusHints mStatusHints;
+ private Bundle mExtras = new Bundle();
+
+ private MockInCallService mInCallService;
+ private Call mCall;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ if (TestUtils.shouldTestTelecom(mContext)) {
+ PhoneAccount account = setupConnectionService(
+ new MockConnectionService() {
+ @Override
+ public Connection onCreateOutgoingConnection(
+ PhoneAccountHandle connectionManagerPhoneAccount,
+ ConnectionRequest request) {
+ Connection connection = super.onCreateOutgoingConnection(
+ connectionManagerPhoneAccount,
+ request);
+ // Modify the connection object created with local values.
+ connection.setConnectionCapabilities(CONNECTION_CAPABILITIES);
+ connection.setCallerDisplayName(
+ CALLER_DISPLAY_NAME,
+ CALLER_DISPLAY_NAME_PRESENTATION);
+ connection.setExtras(mExtras);
+ mStatusHints = new StatusHints(
+ "CTS test",
+ Icon.createWithResource(
+ getInstrumentation().getContext(),
+ R.drawable.ic_phone_24dp),
+ null);
+ connection.setStatusHints(mStatusHints);
+ lock.release();
+ return connection;
+ }
+ }, FLAG_REGISTER | FLAG_ENABLE);
+
+ }
+ /** Place a call as a part of the setup before we test the various
+ * Call details.
+ */
+ placeAndVerifyCall();
+
+ mInCallService = mInCallCallbacks.getService();
+ mCall = mInCallService.getLastCall();
+ }
+
+ /**
+ * Tests whether the getAccountHandle() getter returns the correct object.
+ */
+ public void testAccountHandle() {
+ assertThat(mCall.getDetails().getAccountHandle(), is(PhoneAccountHandle.class));
+ assertEquals(TEST_PHONE_ACCOUNT_HANDLE, mCall.getDetails().getAccountHandle());
+ }
+
+ /**
+ * Tests whether the getCallCapabilities() getter returns the correct object.
+ */
+ public void testCallCapabilities() {
+ assertThat(mCall.getDetails().getCallCapabilities(), is(Integer.class));
+ assertEquals(CALL_CAPABILITIES, mCall.getDetails().getCallCapabilities());
+ }
+
+ /**
+ * Tests whether the getCallerDisplayName() getter returns the correct object.
+ */
+ public void testCallerDisplayName() {
+ assertThat(mCall.getDetails().getCallerDisplayName(), is(String.class));
+ assertEquals(CALLER_DISPLAY_NAME, mCall.getDetails().getCallerDisplayName());
+ }
+
+ /**
+ * Tests whether the getCallerDisplayNamePresentation() getter returns the correct object.
+ */
+ public void testCallerDisplayNamePresentation() {
+ assertThat(mCall.getDetails().getCallerDisplayNamePresentation(), is(Integer.class));
+ assertEquals(CALLER_DISPLAY_NAME_PRESENTATION, mCall.getDetails().getCallerDisplayNamePresentation());
+ }
+
+ /**
+ * Tests whether the getCallProperties() getter returns the correct object.
+ */
+ public void testCallProperties() {
+ assertThat(mCall.getDetails().getCallProperties(), is(Integer.class));
+ assertEquals(CALL_PROPERTIES, mCall.getDetails().getCallProperties());
+ }
+
+ /**
+ * Tests whether the getConnectTimeMillis() getter returns the correct object.
+ */
+ public void testConnectTimeMillis() {
+ assertThat(mCall.getDetails().getConnectTimeMillis(), is(Long.class));
+ }
+
+ /**
+ * Tests whether the getDisconnectCause() getter returns the correct object.
+ */
+ public void testDisconnectCause() {
+ assertThat(mCall.getDetails().getDisconnectCause(), is(DisconnectCause.class));
+ }
+
+ /**
+ * Tests whether the getExtras() getter returns the correct object.
+ */
+ public void testExtras() {
+ assertThat(mCall.getDetails().getExtras(), is(Bundle.class));
+ }
+
+ /**
+ * Tests whether the getIntentExtras() getter returns the correct object.
+ */
+ public void testIntentExtras() {
+ assertThat(mCall.getDetails().getIntentExtras(), is(Bundle.class));
+ }
+
+ /**
+ * Tests whether the getGatewayInfo() getter returns the correct object.
+ */
+ public void testGatewayInfo() {
+ assertThat(mCall.getDetails().getGatewayInfo(), is(GatewayInfo.class));
+ }
+
+ /**
+ * Tests whether the getHandle() getter returns the correct object.
+ */
+ public void testHandle() {
+ assertThat(mCall.getDetails().getHandle(), is(Uri.class));
+ assertEquals(getTestNumber(), mCall.getDetails().getHandle());
+ }
+
+ /**
+ * Tests whether the getHandlePresentation() getter returns the correct object.
+ */
+ public void testHandlePresentation() {
+ assertThat(mCall.getDetails().getHandlePresentation(), is(Integer.class));
+ assertEquals(MockConnectionService.CONNECTION_PRESENTATION, mCall.getDetails().getHandlePresentation());
+ }
+
+ /**
+ * Tests whether the getStatusHints() getter returns the correct object.
+ */
+ public void testStatusHints() {
+ assertThat(mCall.getDetails().getStatusHints(), is(StatusHints.class));
+ assertEquals(mStatusHints.getLabel(), mCall.getDetails().getStatusHints().getLabel());
+ assertEquals(
+ mStatusHints.getIcon().toString(),
+ mCall.getDetails().getStatusHints().getIcon().toString());
+ assertEquals(mStatusHints.getExtras(), mCall.getDetails().getStatusHints().getExtras());
+ }
+
+ /**
+ * Tests whether the getVideoState() getter returns the correct object.
+ */
+ public void testVideoState() {
+ assertThat(mCall.getDetails().getVideoState(), is(Integer.class));
+ }
+}
diff --git a/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java b/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java
index acd93f7..250f197 100644
--- a/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java
+++ b/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java
@@ -29,6 +29,8 @@
* received.
*/
public class MockConnectionService extends CtsConnectionService {
+ public static final int CONNECTION_PRESENTATION = TelecomManager.PRESENTATION_ALLOWED;
+
/**
* Used to control whether the {@link MockVideoProvider} will be created when connections are
* created. Used by {@link VideoCallTest#testVideoCallDelayProvider()} to test scenario where
@@ -44,7 +46,7 @@
public Connection onCreateOutgoingConnection(PhoneAccountHandle connectionManagerPhoneAccount,
ConnectionRequest request) {
final MockConnection connection = new MockConnection();
- connection.setAddress(request.getAddress(), TelecomManager.PRESENTATION_ALLOWED);
+ connection.setAddress(request.getAddress(), CONNECTION_PRESENTATION);
if (mCreateVideoProvider) {
connection.createMockVideoProvider();
} else {
@@ -61,7 +63,7 @@
public Connection onCreateIncomingConnection(PhoneAccountHandle connectionManagerPhoneAccount,
ConnectionRequest request) {
final MockConnection connection = new MockConnection();
- connection.setAddress(request.getAddress(), TelecomManager.PRESENTATION_ALLOWED);
+ connection.setAddress(request.getAddress(), CONNECTION_PRESENTATION);
connection.createMockVideoProvider();
connection.setVideoState(request.getVideoState());
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java
new file mode 100644
index 0000000..becc2f7
--- /dev/null
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2015 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.uirendering.cts.testclasses;
+
+import android.graphics.Canvas;
+import android.graphics.Path;
+import android.graphics.RectF;
+import android.graphics.Region;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import android.uirendering.cts.testinfrastructure.CanvasClient;
+
+/**
+ * Tests of state query-able from canvas at draw time.
+ *
+ * Although these tests don't verify drawing content, they still make use of ActivityTestBase's
+ * capability to test the hardware accelerated Canvas in the way that it is used by Views.
+ */
+public class CanvasStateTests extends ActivityTestBase {
+
+ @SmallTest
+ public void testClipRectReturnValues() {
+ createTest()
+ .addCanvasClient(new CanvasClient() {
+ @Override
+ public void draw(Canvas canvas, int width, int height) {
+ canvas.save();
+ boolean isNonEmpty = canvas.clipRect(0, 0, 20, 20);
+ assertTrue("clip state should be non empty", isNonEmpty);
+
+ isNonEmpty = canvas.clipRect(0, 40, 20, 60);
+ assertFalse("clip state should be empty", isNonEmpty);
+ canvas.restore();
+ }
+ })
+ .runWithoutVerification();
+ }
+
+ @SmallTest
+ public void testClipRegionReturnValues() {
+ createTest()
+ .addCanvasClient(new CanvasClient() {
+ @Override
+ public void draw(Canvas canvas, int width, int height) {
+ canvas.save();
+ RectF clipRectF = new RectF(0, 0, 20, 20);
+
+ assertFalse(canvas.quickReject(0, 0, 20, 20, Canvas.EdgeType.BW));
+ if (!canvas.isHardwareAccelerated()) {
+ // SW canvas may not be in View space, so we offset the clipping region
+ // so it will operate within the canvas client's window.
+ // (Currently, this isn't necessary, since SW layer size == draw area)
+ canvas.getMatrix().mapRect(clipRectF);
+ }
+
+ Region rectRegion = new Region();
+ rectRegion.set((int) clipRectF.left, (int) clipRectF.top,
+ (int) clipRectF.right, (int) clipRectF.bottom);
+
+ boolean isNonEmpty = canvas.clipRegion(rectRegion);
+ assertTrue("clip state should be non empty", isNonEmpty);
+
+ // Note: we don't test that non-intersecting clip regions empty the clip,
+ // For region clipping, the impl is allowed to return true conservatively
+ // in many cases.
+ canvas.restore();
+ }
+ })
+ .runWithoutVerification();
+ }
+
+ @SmallTest
+ public void testClipPathReturnValues() {
+ createTest()
+ .addCanvasClient(new CanvasClient() {
+ @Override
+ public void draw(Canvas canvas, int width, int height) {
+ canvas.save();
+ Path rectPath = new Path();
+ rectPath.addRect(0, 0, 20, 20, Path.Direction.CW);
+
+ boolean isNonEmpty = canvas.clipPath(rectPath);
+ assertTrue("clip state should be non empty", isNonEmpty);
+
+ rectPath.offset(0, 40);
+ isNonEmpty = canvas.clipPath(rectPath);
+ assertFalse("clip state should be empty", isNonEmpty);
+ canvas.restore();
+ }
+ })
+ .runWithoutVerification();
+ }
+ @SmallTest
+ public void testQuickReject() {
+ createTest()
+ .addCanvasClient(new CanvasClient() {
+ @Override
+ public void draw(Canvas canvas, int width, int height) {
+ canvas.save();
+ canvas.clipRect(0, 0, 20, 20);
+
+ // not rejected!
+ assertFalse(canvas.quickReject(0, 0, 20, 20, Canvas.EdgeType.BW));
+
+ // rejected!
+ assertTrue(canvas.quickReject(0, 40, 20, 60, Canvas.EdgeType.BW));
+ canvas.restore();
+ }
+ })
+ .runWithoutVerification();
+ }
+}
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java
index 12ae2a3..2726dac 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2015 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.uirendering.cts.testclasses;
import android.graphics.Canvas;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
index 8c5f245..526f4f9 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
@@ -263,6 +263,20 @@
}
}
+ /**
+ * Runs a test where each testcase is run without verification. Should only be used
+ * where custom CanvasClients, Views, or ViewInitializers do their own internal
+ * test assertions.
+ */
+ public void runWithoutVerification() {
+ runWithVerifier(new BitmapVerifier() {
+ @Override
+ public boolean verify(int[] bitmap, int offset, int stride, int width, int height) {
+ return true;
+ }
+ });
+ }
+
public TestCaseBuilder addWebView(String webViewUrl,
@Nullable ViewInitializer viewInitializer) {
return addWebView(webViewUrl, viewInitializer, false)