Add TestDialerActivity
Add a test dialer activity to Telecomm tests to exercise
default-dialer related APIs.
Change-Id: Ib8f9b70d683e8aff9091abb3f7766ec074712cfe
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 570b2ae..807e669 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -16,31 +16,32 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.telecomm.tests">
+
<application android:label="@string/app_name">
<uses-library android:name="android.test.runner" />
<!-- Miscellaneous telecomm app-related test activities. -->
<!-- TODO(santoscordon): STOPSHIP Services in this manifest need permission protection. -->
- <service android:name="com.android.telecomm.testcallservice.TestCallServiceProvider">
+ <service android:name="com.android.telecomm.testapps.TestCallServiceProvider">
<intent-filter>
<action android:name="android.telecomm.CallServiceProvider" />
</intent-filter>
</service>
- <service android:name="com.android.telecomm.testcallservice.TestCallService">
+ <service android:name="com.android.telecomm.testapps.TestCallService">
<intent-filter>
<action android:name="android.telecomm.CallService" />
</intent-filter>
</service>
- <service android:name="com.android.telecomm.testcallservice.DummyCallServiceSelector">
+ <service android:name="com.android.telecomm.testapps.DummyCallServiceSelector">
<intent-filter>
<action android:name="android.telecomm.CallServiceSelector" />
</intent-filter>
</service>
- <activity android:name="com.android.telecomm.testcallservice.TestCallActivity"
+ <activity android:name="com.android.telecomm.testapps.TestCallActivity"
android:label="@string/testCallActivityLabel">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -49,14 +50,48 @@
</intent-filter>
</activity>
- <receiver android:name="com.android.telecomm.testcallservice.CallNotificationReceiver"
+ <receiver android:name="com.android.telecomm.testapps.CallNotificationReceiver"
android:exported="false">
<intent-filter>
- <action android:name="com.android.telecomm.testcallservice.ACTION_CALL_SERVICE_EXIT"
+ <action android:name="com.android.telecomm.testapps.ACTION_CALL_SERVICE_EXIT"
/>
</intent-filter>
</receiver>
+ <activity android:name="com.android.telecomm.testapps.TestDialerActivity"
+ android:label="@string/testDialerActivityLabel" >
+ <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/layout/testdialer_main.xml b/tests/res/layout/testdialer_main.xml
new file mode 100644
index 0000000..a5453fc
--- /dev/null
+++ b/tests/res/layout/testdialer_main.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+ <EditText
+ android:id="@+id/number"
+ android:inputType="number"
+ android:layout_width="200dp"
+ android:layout_height="wrap_content" />
+ <Button
+ android:id="@+id/place_call_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/placeCallButton" />
+ <Button
+ android:id="@+id/set_default_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/defaultDialerButton" />
+</LinearLayout>
diff --git a/tests/res/values/donottranslate_strings.xml b/tests/res/values/donottranslate_strings.xml
index 6e4788f..76d8777 100644
--- a/tests/res/values/donottranslate_strings.xml
+++ b/tests/res/values/donottranslate_strings.xml
@@ -20,4 +20,13 @@
<!-- String for the TestCallActivity -->
<string name="testCallActivityLabel">Test CallService 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/telecomm/testcallservice/CallNotificationReceiver.java b/tests/src/com/android/telecomm/testapps/CallNotificationReceiver.java
similarity index 96%
rename from tests/src/com/android/telecomm/testcallservice/CallNotificationReceiver.java
rename to tests/src/com/android/telecomm/testapps/CallNotificationReceiver.java
index 5e74069..4ab908f 100644
--- a/tests/src/com/android/telecomm/testcallservice/CallNotificationReceiver.java
+++ b/tests/src/com/android/telecomm/testapps/CallNotificationReceiver.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.telecomm.testcallservice;
+package com.android.telecomm.testapps;
import android.content.BroadcastReceiver;
import android.content.Context;
diff --git a/tests/src/com/android/telecomm/testcallservice/CallServiceNotifier.java b/tests/src/com/android/telecomm/testapps/CallServiceNotifier.java
similarity index 98%
rename from tests/src/com/android/telecomm/testcallservice/CallServiceNotifier.java
rename to tests/src/com/android/telecomm/testapps/CallServiceNotifier.java
index e88c293..336ce56 100644
--- a/tests/src/com/android/telecomm/testcallservice/CallServiceNotifier.java
+++ b/tests/src/com/android/telecomm/testapps/CallServiceNotifier.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.telecomm.testcallservice;
+package com.android.telecomm.testapps;
import android.app.Notification;
import android.app.NotificationManager;
diff --git a/tests/src/com/android/telecomm/testcallservice/DummyCallServiceSelector.java b/tests/src/com/android/telecomm/testapps/DummyCallServiceSelector.java
similarity index 98%
rename from tests/src/com/android/telecomm/testcallservice/DummyCallServiceSelector.java
rename to tests/src/com/android/telecomm/testapps/DummyCallServiceSelector.java
index 28085ea..5f0db05 100644
--- a/tests/src/com/android/telecomm/testcallservice/DummyCallServiceSelector.java
+++ b/tests/src/com/android/telecomm/testapps/DummyCallServiceSelector.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.telecomm.testcallservice;
+package com.android.telecomm.testapps;
import android.net.Uri;
import android.os.Bundle;
diff --git a/tests/src/com/android/telecomm/testcallservice/TestCallActivity.java b/tests/src/com/android/telecomm/testapps/TestCallActivity.java
similarity index 96%
rename from tests/src/com/android/telecomm/testcallservice/TestCallActivity.java
rename to tests/src/com/android/telecomm/testapps/TestCallActivity.java
index 5c483ef..9752252 100644
--- a/tests/src/com/android/telecomm/testcallservice/TestCallActivity.java
+++ b/tests/src/com/android/telecomm/testapps/TestCallActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.telecomm.testcallservice;
+package com.android.telecomm.testapps;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/src/com/android/telecomm/testcallservice/TestCallService.java b/tests/src/com/android/telecomm/testapps/TestCallService.java
similarity index 99%
rename from tests/src/com/android/telecomm/testcallservice/TestCallService.java
rename to tests/src/com/android/telecomm/testapps/TestCallService.java
index 3c9827a..d34a2d2 100644
--- a/tests/src/com/android/telecomm/testcallservice/TestCallService.java
+++ b/tests/src/com/android/telecomm/testapps/TestCallService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.telecomm.testcallservice;
+package com.android.telecomm.testapps;
import android.content.Intent;
import android.media.MediaPlayer;
diff --git a/tests/src/com/android/telecomm/testcallservice/TestCallServiceProvider.java b/tests/src/com/android/telecomm/testapps/TestCallServiceProvider.java
similarity index 96%
rename from tests/src/com/android/telecomm/testcallservice/TestCallServiceProvider.java
rename to tests/src/com/android/telecomm/testapps/TestCallServiceProvider.java
index 3a6646c..a8ccaa1 100644
--- a/tests/src/com/android/telecomm/testcallservice/TestCallServiceProvider.java
+++ b/tests/src/com/android/telecomm/testapps/TestCallServiceProvider.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.telecomm.testcallservice;
+package com.android.telecomm.testapps;
import android.telecomm.CallServiceDescriptor;
import android.telecomm.CallServiceLookupResponse;
diff --git a/tests/src/com/android/telecomm/testapps/TestDialerActivity.java b/tests/src/com/android/telecomm/testapps/TestDialerActivity.java
new file mode 100644
index 0000000..405bca5
--- /dev/null
+++ b/tests/src/com/android/telecomm/testapps/TestDialerActivity.java
@@ -0,0 +1,56 @@
+package com.android.telecomm.testapps;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.EditText;
+
+import com.android.telecomm.tests.R;
+
+public class TestDialerActivity extends Activity {
+ private EditText mNumberView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.testdialer_main);
+ findViewById(R.id.set_default_button).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setDefault();
+ }
+ });
+ findViewById(R.id.place_call_button).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ placeCall();
+ }
+ });
+
+ mNumberView = (EditText) findViewById(R.id.number);
+ updateEditTextWithNumber();
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ updateEditTextWithNumber();
+ }
+
+ private void updateEditTextWithNumber() {
+ Intent intent = getIntent();
+ if (intent != null) {
+ mNumberView.setText(intent.getDataString());
+ }
+ }
+
+ private void setDefault() {
+ // TODO: Send a request to become the default dialer application
+ }
+
+ private void placeCall() {
+ // TODO: Place a call with the number entered in the number field
+ }
+}