Split unit tests and interactive test apps apart
This CL splits the automated unit tests (*.tests package) and the
interactive test connection services (*.testapps package).
Apart from code hygiene and flexibility moving forward, this makes
Android manifest and build files, and the relevant dependencies,
simpler and easier to follow.
Change-Id: Id8c7763ae65f437fdfdabe8b0a4f3561adadbcb3
diff --git a/testapps/Android.mk b/testapps/Android.mk
new file mode 100644
index 0000000..9c11d34
--- /dev/null
+++ b/testapps/Android.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2013 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-ex-camera2 \
+ guava
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := TelecomTestApps
+LOCAL_CERTIFICATE := platform
+
+LOCAL_MODULE_TAGS := tests
+
+include $(BUILD_PACKAGE)
diff --git a/testapps/AndroidManifest.xml b/testapps/AndroidManifest.xml
new file mode 100644
index 0000000..747d377
--- /dev/null
+++ b/testapps/AndroidManifest.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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"
+ coreApp="true"
+ package="com.android.server.telecom.testapps">
+
+ <uses-permission android:name="android.permission.CAMERA" />
+ <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE" />
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission android:name="android.permission.REGISTER_CALL_PROVIDER" />
+ <uses-permission android:name="android.permission.REGISTER_CONNECTION_MANAGER" />
+ <uses-permission android:name="android.permission.REGISTER_SIM_SUBSCRIPTION" />
+
+ <application android:label="@string/app_name">
+ <uses-library android:name="android.test.runner" />
+
+ <!-- Miscellaneous telecom app-related test activities. -->
+
+ <service android:name="com.android.server.telecom.testapps.TestConnectionService"
+ android:permission="android.permission.BIND_CONNECTION_SERVICE" >
+ <intent-filter>
+ <action android:name="android.telecom.ConnectionService" />
+ </intent-filter>
+ </service>
+
+ <service android:name="com.android.server.telecom.testapps.TestConnectionManager"
+ android:permission="android.permission.BIND_CONNECTION_SERVICE" >
+ <intent-filter>
+ <action android:name="android.telecom.ConnectionService" />
+ </intent-filter>
+ </service>
+
+ <service android:name="com.android.server.telecom.testapps.TestInCallServiceImpl"
+ android:process="com.android.server.telecom.testapps.TestInCallService"
+ android:permission="android.permission.BIND_INCALL_SERVICE" >
+ <intent-filter>
+ <action android:name="android.telecom.InCallService"/>
+ </intent-filter>
+ </service>
+
+ <activity android:name="com.android.server.telecom.testapps.TestCallActivity"
+ android:label="@string/testCallActivityLabel">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.telecom.testapps.ACTION_START_INCOMING_CALL" />
+ <action android:name="android.telecom.testapps.ACTION_NEW_UNKNOWN_CALL" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:scheme="tel" />
+ <data android:scheme="sip" />
+ </intent-filter>
+ </activity>
+
+ <receiver android:name="com.android.server.telecom.testapps.CallNotificationReceiver"
+ android:exported="false">
+ <intent-filter>
+ <action android:name="com.android.server.telecom.testapps.ACTION_CALL_SERVICE_EXIT" />
+ </intent-filter>
+ </receiver>
+
+ <activity android:name="com.android.server.telecom.testapps.TestDialerActivity"
+ android:label="@string/testDialerActivityLabel"
+ android:process="com.android.server.telecom.testapps.TestInCallService">
+ <intent-filter>
+ <action android:name="android.intent.action.DIAL" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:mimeType="vnd.android.cursor.item/phone" />
+ <data android:mimeType="vnd.android.cursor.item/person" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.DIAL" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:scheme="voicemail" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.DIAL" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.intent.action.DIAL" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:scheme="tel" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/testapps/res/drawable-xhdpi/stat_sys_phone_call.png b/testapps/res/drawable-xhdpi/stat_sys_phone_call.png
new file mode 100644
index 0000000..1bb4340
--- /dev/null
+++ b/testapps/res/drawable-xhdpi/stat_sys_phone_call.png
Binary files differ
diff --git a/tests/res/layout/testdialer_main.xml b/testapps/res/layout/testdialer_main.xml
similarity index 100%
rename from tests/res/layout/testdialer_main.xml
rename to testapps/res/layout/testdialer_main.xml
diff --git a/tests/res/raw/beep_boop.ogg b/testapps/res/raw/beep_boop.ogg
similarity index 100%
rename from tests/res/raw/beep_boop.ogg
rename to testapps/res/raw/beep_boop.ogg
Binary files differ
diff --git a/tests/res/raw/outgoing_video.mp4 b/testapps/res/raw/outgoing_video.mp4
similarity index 100%
rename from tests/res/raw/outgoing_video.mp4
rename to testapps/res/raw/outgoing_video.mp4
Binary files differ
diff --git a/tests/res/raw/test_pattern.mp4 b/testapps/res/raw/test_pattern.mp4
similarity index 100%
rename from tests/res/raw/test_pattern.mp4
rename to testapps/res/raw/test_pattern.mp4
Binary files differ
diff --git a/tests/res/raw/test_video.mp4 b/testapps/res/raw/test_video.mp4
similarity index 100%
rename from tests/res/raw/test_video.mp4
rename to testapps/res/raw/test_video.mp4
Binary files differ
diff --git a/testapps/res/values/donottranslate_strings.xml b/testapps/res/values/donottranslate_strings.xml
new file mode 100644
index 0000000..91d8628
--- /dev/null
+++ b/testapps/res/values/donottranslate_strings.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources>
+ <!-- Application label -->
+ <string name="app_name">TelecommTests</string>
+
+ <!-- String for the TestCallActivity -->
+ <string name="testCallActivityLabel">Test Connection Service App</string>
+
+ <!-- String for the TestDialerActivity -->
+ <string name="testDialerActivityLabel">Test Dialer</string>
+
+ <!-- String for button in TestDialerActivity that reassigns the default Dialer -->
+ <string name="defaultDialerButton">Default dialer request</string>
+
+ <!-- String for button in TestDialerActivity that places a test call -->
+ <string name="placeCallButton">Place call</string>
+</resources>
diff --git a/tests/src/com/android/server/telecom/testapps/CallNotificationReceiver.java b/testapps/src/com/android/server/telecom/testapps/CallNotificationReceiver.java
similarity index 100%
rename from tests/src/com/android/server/telecom/testapps/CallNotificationReceiver.java
rename to testapps/src/com/android/server/telecom/testapps/CallNotificationReceiver.java
diff --git a/tests/src/com/android/server/telecom/testapps/CallServiceNotifier.java b/testapps/src/com/android/server/telecom/testapps/CallServiceNotifier.java
similarity index 99%
rename from tests/src/com/android/server/telecom/testapps/CallServiceNotifier.java
rename to testapps/src/com/android/server/telecom/testapps/CallServiceNotifier.java
index d25cc2d..d40f92d 100644
--- a/tests/src/com/android/server/telecom/testapps/CallServiceNotifier.java
+++ b/testapps/src/com/android/server/telecom/testapps/CallServiceNotifier.java
@@ -16,7 +16,7 @@
package com.android.server.telecom.testapps;
-import com.android.server.telecom.tests.R;
+import com.android.server.telecom.testapps.R;
import android.app.Notification;
import android.app.NotificationManager;
diff --git a/tests/src/com/android/server/telecom/testapps/CameraThread.java b/testapps/src/com/android/server/telecom/testapps/CameraThread.java
similarity index 100%
rename from tests/src/com/android/server/telecom/testapps/CameraThread.java
rename to testapps/src/com/android/server/telecom/testapps/CameraThread.java
diff --git a/tests/src/com/android/server/telecom/testapps/TestCallActivity.java b/testapps/src/com/android/server/telecom/testapps/TestCallActivity.java
similarity index 100%
rename from tests/src/com/android/server/telecom/testapps/TestCallActivity.java
rename to testapps/src/com/android/server/telecom/testapps/TestCallActivity.java
diff --git a/tests/src/com/android/server/telecom/testapps/TestConnectionManager.java b/testapps/src/com/android/server/telecom/testapps/TestConnectionManager.java
similarity index 100%
rename from tests/src/com/android/server/telecom/testapps/TestConnectionManager.java
rename to testapps/src/com/android/server/telecom/testapps/TestConnectionManager.java
diff --git a/tests/src/com/android/server/telecom/testapps/TestConnectionService.java b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
similarity index 99%
rename from tests/src/com/android/server/telecom/testapps/TestConnectionService.java
rename to testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
index 2e01276..d71ef9d 100644
--- a/tests/src/com/android/server/telecom/testapps/TestConnectionService.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
@@ -34,7 +34,7 @@
import android.telecom.VideoProfile;
import android.util.Log;
-import com.android.server.telecom.tests.R;
+import com.android.server.telecom.testapps.R;
import java.lang.String;
import java.util.ArrayList;
diff --git a/tests/src/com/android/server/telecom/testapps/TestDialerActivity.java b/testapps/src/com/android/server/telecom/testapps/TestDialerActivity.java
similarity index 96%
rename from tests/src/com/android/server/telecom/testapps/TestDialerActivity.java
rename to testapps/src/com/android/server/telecom/testapps/TestDialerActivity.java
index 7a9ed3f..71c375a 100644
--- a/tests/src/com/android/server/telecom/testapps/TestDialerActivity.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestDialerActivity.java
@@ -7,7 +7,7 @@
import android.view.View.OnClickListener;
import android.widget.EditText;
-import com.android.server.telecom.tests.R;
+import com.android.server.telecom.testapps.R;
public class TestDialerActivity extends Activity {
private EditText mNumberView;
diff --git a/tests/src/com/android/server/telecom/testapps/TestInCallServiceImpl.java b/testapps/src/com/android/server/telecom/testapps/TestInCallServiceImpl.java
similarity index 100%
rename from tests/src/com/android/server/telecom/testapps/TestInCallServiceImpl.java
rename to testapps/src/com/android/server/telecom/testapps/TestInCallServiceImpl.java
diff --git a/tests/src/com/android/server/telecom/testapps/TestManagedVideoProvider.java b/testapps/src/com/android/server/telecom/testapps/TestManagedVideoProvider.java
similarity index 100%
rename from tests/src/com/android/server/telecom/testapps/TestManagedVideoProvider.java
rename to testapps/src/com/android/server/telecom/testapps/TestManagedVideoProvider.java
diff --git a/tests/src/com/android/server/telecom/testapps/TestVideoProvider.java b/testapps/src/com/android/server/telecom/testapps/TestVideoProvider.java
similarity index 99%
rename from tests/src/com/android/server/telecom/testapps/TestVideoProvider.java
rename to testapps/src/com/android/server/telecom/testapps/TestVideoProvider.java
index 494eacc..d372e46 100644
--- a/tests/src/com/android/server/telecom/testapps/TestVideoProvider.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestVideoProvider.java
@@ -19,7 +19,7 @@
import com.android.ex.camera2.blocking.BlockingCameraManager;
import com.android.ex.camera2.blocking.BlockingCameraManager.BlockingOpenException;
import com.android.ex.camera2.blocking.BlockingSessionCallback;
-import com.android.server.telecom.tests.R;
+import com.android.server.telecom.testapps.R;
import android.content.Context;
import android.graphics.SurfaceTexture;
diff --git a/tests/Android.mk b/tests/Android.mk
index 44575f5..ca1b835 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -38,11 +38,9 @@
--auto-add-overlay \
--extra-packages com.android.server.telecom
-LOCAL_PACKAGE_NAME := TelecomTests
+LOCAL_PACKAGE_NAME := TelecomUnitTests
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_TAGS := tests
-LOCAL_INSTRUMENTATION_FOR := Telecom
-
include $(BUILD_PACKAGE)
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 0c632ec..6a08c63 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -30,94 +30,6 @@
<application android:label="@string/app_name"
android:debuggable="true">
<uses-library android:name="android.test.runner" />
-
- <!-- Miscellaneous telecom app-related test activities. -->
-
- <service android:name="com.android.server.telecom.testapps.TestConnectionService"
- android:permission="android.permission.BIND_CONNECTION_SERVICE" >
- <intent-filter>
- <action android:name="android.telecom.ConnectionService" />
- </intent-filter>
- </service>
-
- <service android:name="com.android.server.telecom.tests.MockConnectionService"
- android:permission="android.permission.BIND_CONNECTION_SERVICE" >
- <intent-filter>
- <action android:name="android.telecom.ConnectionService" />
- </intent-filter>
- </service>
-
- <service android:name="com.android.server.telecom.testapps.TestConnectionManager"
- android:permission="android.permission.BIND_CONNECTION_SERVICE" >
- <intent-filter>
- <action android:name="android.telecom.ConnectionService" />
- </intent-filter>
- </service>
-
- <service android:name="com.android.server.telecom.testapps.TestInCallServiceImpl"
- android:process="com.android.server.telecom.testapps.TestInCallService"
- android:permission="android.permission.BIND_INCALL_SERVICE" >
- <intent-filter>
- <action android:name="android.telecom.InCallService"/>
- </intent-filter>
- </service>
-
- <activity android:name="com.android.server.telecom.testapps.TestCallActivity"
- android:label="@string/testCallActivityLabel">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.telecom.testapps.ACTION_START_INCOMING_CALL" />
- <action android:name="android.telecom.testapps.ACTION_NEW_UNKNOWN_CALL" />
- <category android:name="android.intent.category.DEFAULT" />
- <data android:scheme="tel" />
- <data android:scheme="sip" />
- </intent-filter>
- </activity>
-
- <receiver android:name="com.android.server.telecom.testapps.CallNotificationReceiver"
- android:exported="false">
- <intent-filter>
- <action android:name="com.android.server.telecom.testapps.ACTION_CALL_SERVICE_EXIT" />
- </intent-filter>
- </receiver>
-
- <activity android:name="com.android.server.telecom.testapps.TestDialerActivity"
- android:label="@string/testDialerActivityLabel"
- android:process="com.android.server.telecom.testapps.TestInCallService">
- <intent-filter>
- <action android:name="android.intent.action.DIAL" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.BROWSABLE" />
- <data android:mimeType="vnd.android.cursor.item/phone" />
- <data android:mimeType="vnd.android.cursor.item/person" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.DIAL" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.BROWSABLE" />
- <data android:scheme="voicemail" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.DIAL" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.VIEW" />
- <action android:name="android.intent.action.DIAL" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.BROWSABLE" />
- <data android:scheme="tel" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
</application>
<!--
diff --git a/tests/res/values/donottranslate_strings.xml b/tests/res/values/donottranslate_strings.xml
index 91d8628..0a6f5c4 100644
--- a/tests/res/values/donottranslate_strings.xml
+++ b/tests/res/values/donottranslate_strings.xml
@@ -16,17 +16,5 @@
<resources>
<!-- Application label -->
- <string name="app_name">TelecommTests</string>
-
- <!-- String for the TestCallActivity -->
- <string name="testCallActivityLabel">Test Connection Service App</string>
-
- <!-- String for the TestDialerActivity -->
- <string name="testDialerActivityLabel">Test Dialer</string>
-
- <!-- String for button in TestDialerActivity that reassigns the default Dialer -->
- <string name="defaultDialerButton">Default dialer request</string>
-
- <!-- String for button in TestDialerActivity that places a test call -->
- <string name="placeCallButton">Place call</string>
+ <string name="app_name">Telecom Unit Tests</string>
</resources>
diff --git a/tests/src/com/android/server/telecom/tests/PhoneAccountRegistrarTest.java b/tests/src/com/android/server/telecom/tests/PhoneAccountRegistrarTest.java
index a980b48..a5fc04c 100644
--- a/tests/src/com/android/server/telecom/tests/PhoneAccountRegistrarTest.java
+++ b/tests/src/com/android/server/telecom/tests/PhoneAccountRegistrarTest.java
@@ -67,11 +67,11 @@
@Override
public void tearDown() throws Exception {
mRegistrar = null;
- mComponentContextFixture = null;
new File(
mComponentContextFixture.getTestDouble().getApplicationContext().getFilesDir(),
FILE_NAME)
.delete();
+ mComponentContextFixture = null;
super.tearDown();
}