am e610cae3: Merge "Fix typo in streaming media url" into jb-dev
* commit 'e610cae33ab4fa0e7877c6e99275e9ff5c600dd4':
Fix typo in streaming media url
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index d9fc8c1..1de48c1 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -18,7 +18,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.cts.verifier"
android:versionCode="1"
- android:versionName="4.1_r7.9">
+ android:versionName="4.1_r7">
<!-- Using 10 for more complete NFC support... -->
<uses-sdk android:minSdkVersion="10"></uses-sdk>
diff --git a/tests/tests/security/jni/Android.mk b/tests/tests/security/jni/Android.mk
index 830a22a..2541da8 100644
--- a/tests/tests/security/jni/Android.mk
+++ b/tests/tests/security/jni/Android.mk
@@ -27,7 +27,8 @@
android_security_cts_KernelSettingsTest.cpp \
android_security_cts_LinuxRngTest.cpp \
android_security_cts_NativeCodeTest.cpp \
- android_security_cts_LoadEffectLibraryTest.cpp
+ android_security_cts_LoadEffectLibraryTest.cpp \
+ android_security_cts_AudioPolicyBinderTest.cpp
LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
diff --git a/tests/tests/security/jni/CtsSecurityJniOnLoad.cpp b/tests/tests/security/jni/CtsSecurityJniOnLoad.cpp
index 93b5175..7833400 100644
--- a/tests/tests/security/jni/CtsSecurityJniOnLoad.cpp
+++ b/tests/tests/security/jni/CtsSecurityJniOnLoad.cpp
@@ -22,6 +22,7 @@
extern int register_android_security_cts_LinuxRngTest(JNIEnv*);
extern int register_android_security_cts_NativeCodeTest(JNIEnv*);
extern int register_android_security_cts_LoadEffectLibraryTest(JNIEnv*);
+extern int register_android_security_cts_AudioPolicyBinderTest(JNIEnv* env);
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
JNIEnv *env = NULL;
@@ -50,5 +51,9 @@
return JNI_ERR;
}
+ if (register_android_security_cts_AudioPolicyBinderTest(env)) {
+ return JNI_ERR;
+ }
+
return JNI_VERSION_1_4;
}
diff --git a/tests/tests/security/jni/android_security_cts_AudioPolicyBinderTest.cpp b/tests/tests/security/jni/android_security_cts_AudioPolicyBinderTest.cpp
new file mode 100644
index 0000000..9daa2cb
--- /dev/null
+++ b/tests/tests/security/jni/android_security_cts_AudioPolicyBinderTest.cpp
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#define LOG_TAG "AudioPolicyBinderTest-JNI"
+
+#include <jni.h>
+#include <binder/IServiceManager.h>
+#include <media/IAudioPolicyService.h>
+#include <media/AudioSystem.h>
+#include <system/audio.h>
+#include <utils/Log.h>
+#include <utils/SystemClock.h>
+
+using namespace android;
+
+/*
+ * Native methods used by
+ * cts/tests/tests/security/src/android/security/cts/AudioPolicyBinderTest.java
+ */
+
+static bool init(sp<IAudioPolicyService>& aps, audio_io_handle_t *output, int *session)
+{
+ aps = 0;
+ if (output != NULL) {
+ *output = 0;
+ }
+ if (session != NULL) {
+ *session = 0;
+ }
+
+ int64_t startTime = 0;
+ sp<IServiceManager> sm = defaultServiceManager();
+ while (aps == 0) {
+ sp<IBinder> binder = defaultServiceManager()->checkService(String16("media.audio_policy"));
+ if (binder == 0) {
+ if (startTime == 0) {
+ startTime = uptimeMillis();
+ } else if ((uptimeMillis()-startTime) > 10000) {
+ ALOGE("timeout while getting audio policy service");
+ return false;
+ }
+ sleep(1);
+ } else {
+ aps = interface_cast<IAudioPolicyService>(binder);
+ }
+ }
+
+ if (output != NULL) {
+ // get a valid output. Any use case will do.
+ for (int stream = 0; stream < AUDIO_STREAM_CNT; stream++) {
+ *output = AudioSystem::getOutput((audio_stream_type_t)stream);
+ if (*output != 0) {
+ break;
+ }
+ }
+ if (*output == 0) {
+ ALOGE("cannot get valid audio output");
+ return false;
+ }
+ }
+ if (session != NULL) {
+ *session = 10000;
+ }
+ return true;
+}
+
+/*
+ * Checks that IAudioPolicyService::startOutput() cannot be called with an
+ * invalid stream type.
+ */
+jboolean android_security_cts_AudioPolicy_test_startOutput(JNIEnv* env __unused,
+ jobject thiz __unused)
+{
+ sp<IAudioPolicyService> aps;
+ audio_io_handle_t output;
+ int session;
+
+ if (!init(aps, &output, &session)) {
+ return false;
+ }
+
+ status_t status = aps->startOutput(output, (audio_stream_type_t)(-1), session);
+ if (status == NO_ERROR) {
+ return false;
+ }
+ status = aps->startOutput(output, (audio_stream_type_t)AUDIO_STREAM_CNT, session);
+ if (status == NO_ERROR) {
+ return false;
+ }
+ return true;
+}
+
+/*
+ * Checks that IAudioPolicyService::stopOutput() cannot be called with an
+ * invalid stream type.
+ */
+jboolean android_security_cts_AudioPolicy_test_stopOutput(JNIEnv* env __unused,
+ jobject thiz __unused)
+{
+ sp<IAudioPolicyService> aps;
+ audio_io_handle_t output;
+ int session;
+
+ if (!init(aps, &output, &session)) {
+ return false;
+ }
+
+ status_t status = aps->stopOutput(output, (audio_stream_type_t)(-1), session);
+ if (status == NO_ERROR) {
+ return false;
+ }
+ status = aps->stopOutput(output, (audio_stream_type_t)AUDIO_STREAM_CNT, session);
+ if (status == NO_ERROR) {
+ return false;
+ }
+ return true;
+}
+
+/*
+ * Checks that IAudioPolicyService::isStreamActive() cannot be called with an
+ * invalid stream type.
+ */
+jboolean android_security_cts_AudioPolicy_test_isStreamActive(JNIEnv* env __unused,
+ jobject thiz __unused)
+{
+ sp<IAudioPolicyService> aps;
+
+ if (!init(aps, NULL, NULL)) {
+ return false;
+ }
+
+ status_t status = aps->isStreamActive((audio_stream_type_t)(-1), 0);
+ if (status == NO_ERROR) {
+ return false;
+ }
+ status = aps->isStreamActive((audio_stream_type_t)AUDIO_STREAM_CNT, 0);
+ if (status == NO_ERROR) {
+ return false;
+ }
+ return true;
+}
+
+static JNINativeMethod gMethods[] = {
+ { "native_test_startOutput", "()Z",
+ (void *) android_security_cts_AudioPolicy_test_startOutput },
+ { "native_test_stopOutput", "()Z",
+ (void *) android_security_cts_AudioPolicy_test_stopOutput },
+ { "native_test_isStreamActive", "()Z",
+ (void *) android_security_cts_AudioPolicy_test_isStreamActive },
+};
+
+int register_android_security_cts_AudioPolicyBinderTest(JNIEnv* env)
+{
+ jclass clazz = env->FindClass("android/security/cts/AudioPolicyBinderTest");
+ return env->RegisterNatives(clazz, gMethods,
+ sizeof(gMethods) / sizeof(JNINativeMethod));
+}
diff --git a/tests/tests/security/src/android/security/cts/AudioPolicyBinderTest.java b/tests/tests/security/src/android/security/cts/AudioPolicyBinderTest.java
new file mode 100644
index 0000000..399d8bb
--- /dev/null
+++ b/tests/tests/security/src/android/security/cts/AudioPolicyBinderTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2014 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.security.cts;
+
+import junit.framework.TestCase;
+
+public class AudioPolicyBinderTest extends TestCase {
+
+ static {
+ System.loadLibrary("ctssecurity_jni");
+ }
+
+ /**
+ * Checks that IAudioPolicyService::startOutput() cannot be called with an
+ * invalid stream type.
+ */
+ public void test_startOutput() throws Exception {
+ assertTrue(native_test_startOutput());
+ }
+
+ /**
+ * Checks that IAudioPolicyService::stopOutput() cannot be called with an
+ * invalid stream type.
+ */
+ public void test_stopOutput() throws Exception {
+ assertTrue(native_test_stopOutput());
+ }
+
+ /**
+ * Checks that IAudioPolicyService::isStreamActive() cannot be called with an
+ * invalid stream type.
+ */
+ public void test_isStreamActive() throws Exception {
+ assertTrue(native_test_isStreamActive());
+ }
+
+ private static native boolean native_test_startOutput();
+ private static native boolean native_test_stopOutput();
+ private static native boolean native_test_isStreamActive();
+}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java b/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
index 11f4418..428b134 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
@@ -31,7 +31,7 @@
@Option(name="cts-install-path", description="the path to the cts installation to use")
private String mCtsRootDirPath = System.getProperty("CTS_ROOT");
- public static final String CTS_BUILD_VERSION = "4.1_r4.9";
+ public static final String CTS_BUILD_VERSION = "4.1_r4";
/**
* {@inheritDoc}