Merge "Rename listener to callback for ConferenceManager and rename strings 2/4" into lmp-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b2dc6b2..743f67c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -35,6 +35,7 @@
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
<uses-permission android:name="android.permission.BIND_CONNECTION_SERVICE" />
<uses-permission android:name="android.permission.BIND_INCALL_SERVICE" />
+ <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<!-- Protects the ability to register any PhoneAccount with a capability flags of either
PhoneAccount#CAPABILITY_CALL_PROVIDER or PhoneAccount#CAPABILITY_SIM_SUBSCRIPTION. -->
@@ -200,15 +201,6 @@
</intent-filter>
</activity>
- <activity android:name=".PhoneAccountPreferencesActivity"
- android:label="@string/phone_account_preferences_title"
- android:configChanges="orientation|screenSize|keyboardHidden"
- android:exported="true">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- </intent-filter>
- </activity>
-
<activity android:name=".ErrorDialogActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:excludeFromRecents="true"
diff --git a/res/layout/phone_account_preferences.xml b/res/layout/phone_account_preferences.xml
deleted file mode 100644
index caf2a47..0000000
--- a/res/layout/phone_account_preferences.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?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:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <fragment
- android:id="@+id/preferences_fragment"
- class="com.android.telecomm.PhoneAccountPreferencesActivity$PreferencesFragment"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-</LinearLayout>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d50d830..9ecc6bb 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -76,21 +76,6 @@
a text response. [CHAR LIMIT=40] -->
<string name="respond_via_sms_confirmation_format">Message sent to <xliff:g id="phone_number">%s</xliff:g>.</string>
- <!-- Title for phone accounts settings screen -->
- <string name="phone_account_preferences_title">Phone account settings</string>
-
- <!-- Title for setting to select default outgoing phone account -->
- <string name="default_outgoing_account_title">Default outgoing account</string>
-
- <!-- Title for setting to select SIM call manager account -->
- <string name="sim_call_manager_account">Wi-Fi calling account</string>
-
- <!-- Indication to "ask every time" for accounts when making a call -->
- <string name="account_ask_every_time">Ask every time</string>
-
- <!-- Indication to not use a SIM call manager -->
- <string name="do_not_use_sim_call_manager">Do not use Wi-Fi calling</string>
-
<!-- Message indicating that the user is not allowed to make non-emergency outgoing phone calls
due to a user restriction -->
<string name="outgoing_call_not_allowed">This user is not allowed to make non-emergency phone calls</string>
diff --git a/res/xml/phone_account_preferences.xml b/res/xml/phone_account_preferences.xml
deleted file mode 100644
index 23313a1..0000000
--- a/res/xml/phone_account_preferences.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- Settings screen for selecting which PhoneAccountHandle to use by default
- for making outgoing phone calls -->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- android:title="@string/phone_account_preferences_title">
- <com.android.telecomm.AccountSelectionPreference
- android:key="default_outgoing_account"
- android:title="@string/default_outgoing_account_title"
- android:defaultValue=""
- android:persistent="false" />
- <com.android.telecomm.AccountSelectionPreference
- android:key="sim_call_manager_account"
- android:title="@string/sim_call_manager_account"
- android:defaultValue=""
- android:persistent="false" />
-</PreferenceScreen>
diff --git a/src/com/android/telecomm/AccountSelectionPreference.java b/src/com/android/telecomm/AccountSelectionPreference.java
deleted file mode 100644
index e7c2bc0..0000000
--- a/src/com/android/telecomm/AccountSelectionPreference.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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 com.android.telecomm;
-
-import android.content.Context;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.telecomm.PhoneAccountHandle;
-import android.util.AttributeSet;
-
-import java.util.List;
-import java.util.Objects;
-
-public class AccountSelectionPreference extends ListPreference implements
- Preference.OnPreferenceChangeListener {
-
- public interface AccountSelectionListener {
- boolean onAccountSelected(AccountSelectionPreference pref, PhoneAccountHandle account);
- }
-
- private AccountSelectionListener mListener;
- private PhoneAccountHandle[] mAccounts;
- private String[] mEntryValues;
- private CharSequence[] mEntries;
-
- public AccountSelectionPreference(Context context) {
- super(context);
- setOnPreferenceChangeListener(this);
- }
-
- public AccountSelectionPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- setOnPreferenceChangeListener(this);
- }
-
- public void setListener(AccountSelectionListener listener) {
- mListener = listener;
- }
-
- public void setModel(
- PhoneAccountRegistrar registrar,
- List<PhoneAccountHandle> accountsList,
- PhoneAccountHandle currentSelection,
- CharSequence nullSelectionString) {
- mAccounts = accountsList.toArray(new PhoneAccountHandle[accountsList.size()]);
- mEntryValues = new String[mAccounts.length + 1];
- mEntries = new CharSequence[mAccounts.length + 1];
-
- int selectedIndex = mAccounts.length; // Points to nullSelectionString by default
- int i = 0;
- for ( ; i < mAccounts.length; i++) {
- CharSequence label = registrar.getPhoneAccount(mAccounts[i]).getLabel();
- mEntries[i] = label == null ? null : label.toString();
- mEntryValues[i] = Integer.toString(i);
- if (Objects.equals(currentSelection, mAccounts[i])) {
- selectedIndex = i;
- }
- }
- mEntryValues[i] = Integer.toString(i);
- mEntries[i] = nullSelectionString;
-
- setEntryValues(mEntryValues);
- setEntries(mEntries);
- setValueIndex(selectedIndex);
- setSummary(mEntries[selectedIndex]);
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- if (mListener != null) {
- int index = Integer.parseInt((String) newValue);
- PhoneAccountHandle account = index < mAccounts.length ? mAccounts[index] : null;
- if (mListener.onAccountSelected(this, account)) {
- setSummary(mEntries[index]);
- return true;
- }
- }
- return false;
- }
-}
diff --git a/src/com/android/telecomm/CallActivity.java b/src/com/android/telecomm/CallActivity.java
index 6d3b98f..f354291 100644
--- a/src/com/android/telecomm/CallActivity.java
+++ b/src/com/android/telecomm/CallActivity.java
@@ -119,9 +119,14 @@
* @param intent Call intent containing data about the handle to call.
*/
private void processOutgoingCallIntent(Intent intent) {
- String uriString = intent.getData().getSchemeSpecificPart();
- Uri handle = Uri.fromParts(
- PhoneNumberUtils.isUriNumber(uriString) ? "sip" : "tel", uriString, null);
+ Uri handle = intent.getData();
+ String scheme = handle.getScheme();
+ String uriString = handle.getSchemeSpecificPart();
+
+ if (!Constants.SCHEME_VOICEMAIL.equals(scheme)) {
+ handle = Uri.fromParts(PhoneNumberUtils.isUriNumber(uriString) ?
+ Constants.SCHEME_SIP : Constants.SCHEME_TEL, uriString, null);
+ }
UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
if (userManager.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS)
diff --git a/src/com/android/telecomm/Constants.java b/src/com/android/telecomm/Constants.java
new file mode 100644
index 0000000..9967fa2
--- /dev/null
+++ b/src/com/android/telecomm/Constants.java
@@ -0,0 +1,35 @@
+/*
+ * 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 com.android.telecomm;
+
+/**
+ * App-wide constants for the phone app.
+ *
+ * Any constants that need to be shared between two or more classes within
+ * the com.android.phone package should be defined here. (Constants that
+ * are private to only one class can go in that class's .java file.)
+ */
+public class Constants {
+ //
+ // URI schemes
+ //
+
+ public static final String SCHEME_SIP = "sip";
+ public static final String SCHEME_SMSTO = "smsto";
+ public static final String SCHEME_TEL = "tel";
+ public static final String SCHEME_VOICEMAIL = "voicemail";
+}
\ No newline at end of file
diff --git a/src/com/android/telecomm/MissedCallNotifier.java b/src/com/android/telecomm/MissedCallNotifier.java
index c3f162a..f3c87e2 100644
--- a/src/com/android/telecomm/MissedCallNotifier.java
+++ b/src/com/android/telecomm/MissedCallNotifier.java
@@ -53,7 +53,6 @@
Calls.TYPE,
};
private static final int MISSED_CALL_NOTIFICATION_ID = 1;
- private static final String SCHEME_SMSTO = "smsto";
private final Context mContext;
private final NotificationManager mNotificationManager;
@@ -237,7 +236,7 @@
private PendingIntent createSendSmsFromNotificationPendingIntent(Uri handle) {
return createTelecommPendingIntent(
TelecommBroadcastReceiver.ACTION_SEND_SMS_FROM_NOTIFICATION,
- Uri.fromParts(SCHEME_SMSTO, handle.getSchemeSpecificPart(), null));
+ Uri.fromParts(Constants.SCHEME_SMSTO, handle.getSchemeSpecificPart(), null));
}
/**
diff --git a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
index 57a776f..1032018 100644
--- a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
+++ b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
@@ -65,10 +65,6 @@
public static final String EXTRA_GATEWAY_ORIGINAL_URI =
"com.android.phone.extra.GATEWAY_ORIGINAL_URI";
- private static final String SCHEME_TEL = "tel";
- private static final String SCHEME_SIP = "sip";
- private static final String SCHEME_VOICEMAIL = "voicemail";
-
private final CallsManager mCallsManager;
private final Call mCall;
private final Intent mIntent;
@@ -117,10 +113,8 @@
return;
}
- Uri resultHandleUri = Uri.fromParts(
- PhoneNumberUtils.isUriNumber(resultNumber) ? SCHEME_SIP : SCHEME_TEL,
- resultNumber,
- null);
+ Uri resultHandleUri = Uri.fromParts(PhoneNumberUtils.isUriNumber(resultNumber) ?
+ Constants.SCHEME_SIP : Constants.SCHEME_TEL, resultNumber, null);
Uri originalUri = mIntent.getData();
@@ -169,7 +163,7 @@
return DisconnectCause.INVALID_NUMBER;
}
- boolean isVoicemailNumber = SCHEME_VOICEMAIL.equals(handle.getScheme());
+ boolean isVoicemailNumber = Constants.SCHEME_VOICEMAIL.equals(handle.getScheme());
if (isVoicemailNumber) {
if (Intent.ACTION_CALL.equals(action)) {
// Voicemail calls will be handled directly by the telephony connection manager
@@ -234,7 +228,7 @@
if (callImmediately) {
Log.i(this, "Placing call immediately instead of waiting for "
+ " OutgoingCallBroadcastReceiver: %s", intent);
- String scheme = isUriNumber ? SCHEME_SIP : SCHEME_TEL;
+ String scheme = isUriNumber ? Constants.SCHEME_SIP : Constants.SCHEME_TEL;
boolean speakerphoneOn = mIntent.getBooleanExtra(
TelecommManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, false);
int videoState = mIntent.getIntExtra(
diff --git a/src/com/android/telecomm/PhoneAccountPreferencesActivity.java b/src/com/android/telecomm/PhoneAccountPreferencesActivity.java
deleted file mode 100644
index 7b64631..0000000
--- a/src/com/android/telecomm/PhoneAccountPreferencesActivity.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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 com.android.telecomm;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.preference.PreferenceFragment;
-import android.telecomm.PhoneAccount;
-import android.telecomm.PhoneAccountHandle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class PhoneAccountPreferencesActivity extends Activity {
-
- private static final String KEY_DEFAULT_OUTGOING_ACCOUNT = "default_outgoing_account";
- private static final String KEY_SIM_CALL_MANAGER_ACCOUNT = "sim_call_manager_account";
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.phone_account_preferences);
- }
-
- public static class PreferencesFragment extends PreferenceFragment
- implements AccountSelectionPreference.AccountSelectionListener {
- private AccountSelectionPreference mDefaultOutgoingAccount;
- private AccountSelectionPreference mSimCallManagerAccount;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- addPreferencesFromResource(R.xml.phone_account_preferences);
-
- mDefaultOutgoingAccount = (AccountSelectionPreference)
- findPreference(KEY_DEFAULT_OUTGOING_ACCOUNT);
- mSimCallManagerAccount = (AccountSelectionPreference)
- findPreference(KEY_SIM_CALL_MANAGER_ACCOUNT);
-
- PhoneAccountRegistrar registrar = TelecommApp.getInstance().getPhoneAccountRegistrar();
-
- mDefaultOutgoingAccount.setModel(
- registrar,
- registrar.getOutgoingPhoneAccounts(),
- registrar.getUserSelectedOutgoingPhoneAccount(),
- getString(R.string.account_ask_every_time));
-
- mSimCallManagerAccount.setModel(
- registrar,
- registrar.getAllConnectionManagerPhoneAccounts(),
- registrar.getSimCallManager(),
- getString(R.string.do_not_use_sim_call_manager));
-
- mDefaultOutgoingAccount.setListener(this);
- mSimCallManagerAccount.setListener(this);
- }
-
- @Override
- public boolean onAccountSelected(
- AccountSelectionPreference p, PhoneAccountHandle account) {
- PhoneAccountRegistrar registrar = TelecommApp.getInstance().getPhoneAccountRegistrar();
- if (p == mDefaultOutgoingAccount) {
- registrar.setDefaultOutgoingPhoneAccount(account);
- return true;
- } else if (p == mSimCallManagerAccount) {
- registrar.setSimCallManager(account);
- return true;
- }
- return false;
- }
- }
-}
diff --git a/src/com/android/telecomm/PhoneAccountRegistrar.java b/src/com/android/telecomm/PhoneAccountRegistrar.java
index f7652d7..74cdf90 100644
--- a/src/com/android/telecomm/PhoneAccountRegistrar.java
+++ b/src/com/android/telecomm/PhoneAccountRegistrar.java
@@ -147,7 +147,7 @@
return null;
}
- public void setDefaultOutgoingPhoneAccount(PhoneAccountHandle accountHandle) {
+ public void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle) {
if (accountHandle == null) {
// Asking to clear the default outgoing is a valid request
mState.defaultOutgoing = null;
diff --git a/src/com/android/telecomm/RespondViaSmsManager.java b/src/com/android/telecomm/RespondViaSmsManager.java
index f1e6033..60f419d 100644
--- a/src/com/android/telecomm/RespondViaSmsManager.java
+++ b/src/com/android/telecomm/RespondViaSmsManager.java
@@ -38,8 +38,6 @@
* Helper class to manage the "Respond via Message" feature for incoming calls.
*/
public class RespondViaSmsManager extends CallsManagerListenerBase {
- private static final String SCHEME_SMSTO = "smsto";
-
private static final int MSG_CANNED_TEXT_MESSAGES_READY = 1;
private static final int MSG_SHOW_SENT_TOAST = 2;
@@ -170,7 +168,7 @@
TelecommApp.getInstance(), true /*updateIfNeeded*/);
if (component != null) {
// Build and send the intent
- final Uri uri = Uri.fromParts(SCHEME_SMSTO, phoneNumber, null);
+ final Uri uri = Uri.fromParts(Constants.SCHEME_SMSTO, phoneNumber, null);
final Intent intent = new Intent(TelephonyManager.ACTION_RESPOND_VIA_MESSAGE, uri);
intent.putExtra(Intent.EXTRA_TEXT, textMessage);
mHandler.obtainMessage(MSG_SHOW_SENT_TOAST, phoneNumber).sendToTarget();
diff --git a/src/com/android/telecomm/TelecommServiceImpl.java b/src/com/android/telecomm/TelecommServiceImpl.java
index ef26085..93337a5 100644
--- a/src/com/android/telecomm/TelecommServiceImpl.java
+++ b/src/com/android/telecomm/TelecommServiceImpl.java
@@ -170,13 +170,23 @@
}
@Override
- public void setDefaultOutgoingPhoneAccount(PhoneAccountHandle accountHandle) {
+ public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount() {
+ try {
+ return mPhoneAccountRegistrar.getUserSelectedOutgoingPhoneAccount();
+ } catch (Exception e) {
+ Log.e(this, e, "getUserSelectedOutgoingPhoneAccount");
+ throw e;
+ }
+ }
+
+ @Override
+ public void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle) {
enforceModifyPermission();
try {
- mPhoneAccountRegistrar.setDefaultOutgoingPhoneAccount(accountHandle);
+ mPhoneAccountRegistrar.setUserSelectedOutgoingPhoneAccount(accountHandle);
} catch (Exception e) {
- Log.e(this, e, "setDefaultOutgoingPhoneAccount");
+ Log.e(this, e, "setUserSelectedOutgoingPhoneAccount");
throw e;
}
}
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 8ae47d2..47ce802 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -60,6 +60,11 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
+ <intent-filter>
+ <action android:name="android.telecomm.testapps.ACTION_START_INCOMING_CALL" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:scheme="tel" />
+ </intent-filter>
</activity>
<receiver android:name="com.android.telecomm.testapps.CallNotificationReceiver"
diff --git a/tests/src/com/android/telecomm/testapps/CallNotificationReceiver.java b/tests/src/com/android/telecomm/testapps/CallNotificationReceiver.java
index fb44069..5b49434 100644
--- a/tests/src/com/android/telecomm/testapps/CallNotificationReceiver.java
+++ b/tests/src/com/android/telecomm/testapps/CallNotificationReceiver.java
@@ -20,6 +20,7 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.net.Uri;
import android.os.Bundle;
import android.telecomm.PhoneAccountHandle;
import android.telecomm.TelecommManager;
@@ -55,19 +56,19 @@
} else if (ACTION_SHOW_ALL_PHONE_ACCOUNTS.equals(action)) {
CallServiceNotifier.getInstance().showAllPhoneAccounts(context);
} else if (ACTION_VIDEO_CALL.equals(action)) {
- sendIncomingCallIntent(context, true);
+ sendIncomingCallIntent(context, null, true);
} else if (ACTION_AUDIO_CALL.equals(action)) {
- sendIncomingCallIntent(context, false);
+ sendIncomingCallIntent(context, null, false);
}
}
/**
- * Creates the intent to add an incoming call through Telecomm.
+ * Creates and sends the intent to add an incoming call through Telecomm.
*
* @param context The current context.
* @param isVideoCall {@code True} if this is a video call.
*/
- private void sendIncomingCallIntent(Context context, boolean isVideoCall) {
+ public static void sendIncomingCallIntent(Context context, Uri handle, boolean isVideoCall) {
PhoneAccountHandle phoneAccount = new PhoneAccountHandle(
new ComponentName(context, TestConnectionService.class),
CallServiceNotifier.SIM_SUBSCRIPTION_ID);
@@ -75,7 +76,10 @@
// For the purposes of testing, indicate whether the incoming call is a video call by
// stashing an indicator in the EXTRA_INCOMING_CALL_EXTRAS.
Bundle extras = new Bundle();
- extras.putBoolean(TestConnectionService.IS_VIDEO_CALL, isVideoCall);
+ extras.putBoolean(TestConnectionService.EXTRA_IS_VIDEO_CALL, isVideoCall);
+ if (handle != null) {
+ extras.putParcelable(TestConnectionService.EXTRA_HANDLE, handle);
+ }
TelecommManager.from(context).addNewIncomingCall(phoneAccount, extras);
}
diff --git a/tests/src/com/android/telecomm/testapps/TestCallActivity.java b/tests/src/com/android/telecomm/testapps/TestCallActivity.java
index b85888d..4caf3e8 100644
--- a/tests/src/com/android/telecomm/testapps/TestCallActivity.java
+++ b/tests/src/com/android/telecomm/testapps/TestCallActivity.java
@@ -17,21 +17,41 @@
package com.android.telecomm.testapps;
import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
import android.os.Bundle;
+import android.util.Log;
/**
* This activity exists in order to add an icon to the launcher. This activity has no UI of its own
* and instead starts the notification for {@link TestConnectionService} via
* {@link CallServiceNotifier}. After triggering a notification update, this activity immediately
* finishes.
+ *
+ * To directly trigger a new incoming call, use the following adb command:
+ *
+ * adb shell am start -a android.telecomm.testapps.ACTION_START_INCOMING_CALL -d "tel:123456789"
*/
public class TestCallActivity extends Activity {
+ public static final String ACTION_NEW_INCOMING_CALL =
+ "android.telecomm.testapps.ACTION_START_INCOMING_CALL";
+
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
-
+ final Intent intent = getIntent();
+ if (intent != null && intent.getData() != null) {
+ startIncomingCallBroadcast(intent.getData());
+ }
CallServiceNotifier.getInstance().updateNotification(this);
finish();
}
+
+ /**
+ * Bypass the notification and start the test incoming call directly.
+ */
+ private void startIncomingCallBroadcast(Uri handle) {
+ CallNotificationReceiver.sendIncomingCallIntent(this, handle, false);
+ }
}
diff --git a/tests/src/com/android/telecomm/testapps/TestConnectionService.java b/tests/src/com/android/telecomm/testapps/TestConnectionService.java
index c50e7ab..e5d54e9 100644
--- a/tests/src/com/android/telecomm/testapps/TestConnectionService.java
+++ b/tests/src/com/android/telecomm/testapps/TestConnectionService.java
Binary files differ
diff --git a/tests/src/com/android/telecomm/testapps/TestVideoProvider.java b/tests/src/com/android/telecomm/testapps/TestVideoProvider.java
index 64a64ed..f338101 100644
--- a/tests/src/com/android/telecomm/testapps/TestVideoProvider.java
+++ b/tests/src/com/android/telecomm/testapps/TestVideoProvider.java
@@ -18,7 +18,7 @@
import com.android.ex.camera2.blocking.BlockingCameraManager;
import com.android.ex.camera2.blocking.BlockingCameraManager.BlockingOpenException;
-import com.android.ex.camera2.blocking.BlockingSessionListener;
+import com.android.ex.camera2.blocking.BlockingSessionCallback;
import com.android.telecomm.tests.R;
import android.content.Context;
@@ -253,7 +253,7 @@
surfaces.add(mPreviewSurface);
CaptureRequest.Builder mCaptureRequest = null;
try {
- BlockingSessionListener blkSession = new BlockingSessionListener();
+ BlockingSessionCallback blkSession = new BlockingSessionCallback();
mCameraDevice.createCaptureSession(surfaces, blkSession, mHandler);
mCaptureRequest = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
mCaptureRequest.addTarget(mPreviewSurface);
@@ -265,7 +265,7 @@
// Keep repeating
try {
- mCameraSession.setRepeatingRequest(mCaptureRequest.build(), new CameraCaptureListener(),
+ mCameraSession.setRepeatingRequest(mCaptureRequest.build(), new CameraCaptureCallback(),
mHandler);
} catch (CameraAccessException e) {
log("CameraAccessException: " + e);
@@ -294,7 +294,7 @@
/**
* Required listener for camera capture events.
*/
- private class CameraCaptureListener extends CameraCaptureSession.CaptureListener {
+ private class CameraCaptureCallback extends CameraCaptureSession.CaptureCallback {
@Override
public void onCaptureCompleted(CameraCaptureSession camera, CaptureRequest request,
TotalCaptureResult result) {
diff --git a/tests/src/com/android/telecomm/tests/unit/PhoneAccountRegistrarTest.java b/tests/src/com/android/telecomm/tests/unit/PhoneAccountRegistrarTest.java
index 3522153..41b7924 100644
--- a/tests/src/com/android/telecomm/tests/unit/PhoneAccountRegistrarTest.java
+++ b/tests/src/com/android/telecomm/tests/unit/PhoneAccountRegistrarTest.java
@@ -242,7 +242,7 @@
// Establish initial conditions
assertEquals(null, mRegistrar.getDefaultOutgoingPhoneAccount("tel"));
PhoneAccountHandle h = new PhoneAccountHandle(new ComponentName("pkg0", "cls0"), "id1");
- mRegistrar.setDefaultOutgoingPhoneAccount(h);
+ mRegistrar.setUserSelectedOutgoingPhoneAccount(h);
assertPhoneAccountHandleEquals(h, mRegistrar.getDefaultOutgoingPhoneAccount("tel"));
// If account is un-registered, querying returns null
mRegistrar.unregisterPhoneAccount(h);
@@ -251,10 +251,10 @@
mRegistrar.registerPhoneAccount(makeQuickAccount("pkg0", "cls0", "id1", 99));
assertPhoneAccountHandleEquals(h, mRegistrar.getDefaultOutgoingPhoneAccount("tel"));
// De-register by setting to null
- mRegistrar.setDefaultOutgoingPhoneAccount(null);
+ mRegistrar.setUserSelectedOutgoingPhoneAccount(null);
assertEquals(null, mRegistrar.getDefaultOutgoingPhoneAccount("tel"));
// If argument not have CALL_PROVIDER capability, this is a no-op
- mRegistrar.setDefaultOutgoingPhoneAccount(
+ mRegistrar.setUserSelectedOutgoingPhoneAccount(
new PhoneAccountHandle(new ComponentName("pkg0", "cls0"), "id0"));
assertEquals(null, mRegistrar.getDefaultOutgoingPhoneAccount("tel"));
// If only have one account, it is the default