Merge commit '3631b8e' into mergemeister
Change-Id: I40c4794e1091b26c5cd366dc4baf55626b62a145
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 881ef88..4b1cef5 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -1428,7 +1428,15 @@
*/
public void setVideoState(int videoState) {
// Track which video states were applicable over the duration of the call.
- mVideoStateHistory = mVideoStateHistory | videoState;
+ // Only track the call state when the call is active or disconnected. This ensures we do
+ // not include the video state when:
+ // - Call is incoming (but not answered).
+ // - Call it outgoing (but not answered).
+ // We include the video state when disconnected to ensure that rejected calls reflect the
+ // appropriate video state.
+ if (isActive() || getState() == CallState.DISCONNECTED) {
+ mVideoStateHistory = mVideoStateHistory | videoState;
+ }
mVideoState = videoState;
for (Listener l : mListeners) {
diff --git a/src/com/android/server/telecom/CallLogManager.java b/src/com/android/server/telecom/CallLogManager.java
index 22be8b3..7a87427 100755
--- a/src/com/android/server/telecom/CallLogManager.java
+++ b/src/com/android/server/telecom/CallLogManager.java
@@ -208,8 +208,7 @@
* @return The call features.
*/
private static int getCallFeatures(int videoState) {
- if ((videoState & VideoProfile.VideoState.TX_ENABLED)
- == VideoProfile.VideoState.TX_ENABLED) {
+ if (VideoProfile.VideoState.isVideo(videoState)) {
return Calls.FEATURES_VIDEO;
}
return 0;
diff --git a/testapps/Android.mk b/testapps/Android.mk
new file mode 100644
index 0000000..74928d0
--- /dev/null
+++ b/testapps/Android.mk
@@ -0,0 +1,32 @@
+#
+# 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-support-v4 \
+ 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 a6b2fa2..9f5d579 100644
--- a/tests/src/com/android/server/telecom/testapps/TestConnectionService.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
@@ -38,7 +38,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/testapps/src/com/android/server/telecom/testapps/TestDialerActivity.java b/testapps/src/com/android/server/telecom/testapps/TestDialerActivity.java
new file mode 100644
index 0000000..71c375a
--- /dev/null
+++ b/testapps/src/com/android/server/telecom/testapps/TestDialerActivity.java
@@ -0,0 +1,56 @@
+package com.android.server.telecom.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.server.telecom.testapps.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
+ }
+}
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 c0fc5ea..2dad471 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 d8c5abe..a802768 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -39,11 +39,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 0206679..6a08c63 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -30,65 +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:theme="@android:style/Theme.NoDisplay"
- 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>
- <intent-filter>
- <action android:name="android.telecom.testapps.ACTION_HANGUP_CALLS" />
- <category android:name="android.intent.category.DEFAULT" />
- </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>
</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();
}