Merge "Fix exception when setting audio mode"
diff --git a/res/drawable-xxhdpi/chat_with_others.png b/res/drawable-xxhdpi/chat_with_others.png
deleted file mode 100644
index 6f6b03e..0000000
--- a/res/drawable-xxhdpi/chat_with_others.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/market_wireless.png b/res/drawable-xxhdpi/market_wireless.png
deleted file mode 100644
index e451fe7..0000000
--- a/res/drawable-xxhdpi/market_wireless.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/q_mobile.png b/res/drawable-xxhdpi/q_mobile.png
deleted file mode 100644
index cfc0624..0000000
--- a/res/drawable-xxhdpi/q_mobile.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/talk_to_your_circles.png b/res/drawable-xxhdpi/talk_to_your_circles.png
deleted file mode 100644
index d6bc672..0000000
--- a/res/drawable-xxhdpi/talk_to_your_circles.png
+++ /dev/null
Binary files differ
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e85d7b6..eddeec5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -78,20 +78,20 @@
<!-- DO NOT TRANSLATE. Label for test Subscription 0. -->
- <string name="test_subscription_0_label">Q Mobile</string>
+ <string name="test_account_0_label">Q Mobile</string>
<!-- DO NOT TRANSLATE. Label for test Subscription 1. -->
- <string name="test_subscription_1_label">Market Wireless</string>
+ <string name="test_account_1_label">Market Wireless</string>
<!-- DO NOT TRANSLATE. Label for test Subscription 2. -->
- <string name="test_subscription_2_label">Sonoma Circles Talk Plus</string>
+ <string name="test_account_2_label">Sonoma Circles Talk Plus</string>
<!-- DO NOT TRANSLATE. Label for test Subscription 3. -->
- <string name="test_subscription_3_label">Bay Voice Chat Pro</string>
+ <string name="test_account_3_label">Bay Voice Chat Pro</string>
<!-- DO NOT TRANSLATE. Short description for test Subscription 0. -->
- <string name="test_subscription_0_short_description">Account with Q Mobile</string>
+ <string name="test_account_0_short_description">Account with Q Mobile</string>
<!-- DO NOT TRANSLATE. Short description for test Subscription 1. -->
- <string name="test_subscription_1_short_description">Account with Market Wireless</string>
+ <string name="test_account_1_short_description">Account with Market Wireless</string>
<!-- DO NOT TRANSLATE. Short description for test Subscription 2. -->
- <string name="test_subscription_2_short_description">Talk to everyone in your Circles!</string>
+ <string name="test_account_2_short_description">Talk to everyone in your Circles!</string>
<!-- DO NOT TRANSLATE. Short description for test Subscription 3. -->
- <string name="test_subscription_3_short_description">Chat with Chat Network users</string>
+ <string name="test_account_3_short_description">Chat with Chat Network users</string>
</resources>
diff --git a/src/com/android/telecomm/Call.java b/src/com/android/telecomm/Call.java
index ddd4b1d..cb9353f 100644
--- a/src/com/android/telecomm/Call.java
+++ b/src/com/android/telecomm/Call.java
@@ -27,8 +27,8 @@
import android.telecomm.CallServiceDescriptor;
import android.telecomm.CallState;
import android.telecomm.GatewayInfo;
+import android.telecomm.PhoneAccount;
import android.telecomm.Response;
-import android.telecomm.Subscription;
import android.telecomm.TelecommConstants;
import android.telephony.DisconnectCause;
import android.telephony.PhoneNumberUtils;
@@ -75,6 +75,42 @@
void onCannedSmsResponsesLoaded(Call call);
void onCallVideoProviderChanged(Call call);
void onFeaturesChanged(Call call);
+ void onCallerInfoChanged(Call call);
+ }
+
+ abstract static class ListenerBase implements Listener {
+ @Override
+ public void onSuccessfulOutgoingCall(Call call) {}
+ @Override
+ public void onFailedOutgoingCall(Call call, int errorCode, String errorMsg) {}
+ @Override
+ public void onCancelledOutgoingCall(Call call) {}
+ @Override
+ public void onSuccessfulIncomingCall(Call call, CallInfo callInfo) {}
+ @Override
+ public void onFailedIncomingCall(Call call) {}
+ @Override
+ public void onRequestingRingback(Call call, boolean requestingRingback) {}
+ @Override
+ public void onPostDialWait(Call call, String remaining) {}
+ @Override
+ public void onIsConferenceCapableChanged(Call call, boolean isConferenceCapable) {}
+ @Override
+ public void onExpiredConferenceCall(Call call) {}
+ @Override
+ public void onConfirmedConferenceCall(Call call) {}
+ @Override
+ public void onParentChanged(Call call) {}
+ @Override
+ public void onChildrenChanged(Call call) {}
+ @Override
+ public void onCannedSmsResponsesLoaded(Call call) {}
+ @Override
+ public void onCallVideoProviderChanged(Call call) {}
+ @Override
+ public void onFeaturesChanged(Call call) {}
+ @Override
+ public void onCallerInfoChanged(Call call) {}
}
private static final OnQueryCompleteListener sCallerInfoQueryListener =
@@ -117,7 +153,7 @@
* service. */
private final GatewayInfo mGatewayInfo;
- private final Subscription mSubscription;
+ private final PhoneAccount mAccount;
private final Handler mHandler = new Handler();
@@ -226,15 +262,15 @@
*
* @param handle The handle to dial.
* @param gatewayInfo Gateway information to use for the call.
- * @param subscription Subscription information to use for the call.
+ * @param account Account information to use for the call.
* @param isIncoming True if this is an incoming call.
*/
- Call(Uri handle, GatewayInfo gatewayInfo, Subscription subscription,
+ Call(Uri handle, GatewayInfo gatewayInfo, PhoneAccount account,
boolean isIncoming, boolean isConference) {
mState = isConference ? CallState.ACTIVE : CallState.NEW;
setHandle(handle);
mGatewayInfo = gatewayInfo;
- mSubscription = subscription;
+ mAccount = account;
mIsIncoming = isIncoming;
mIsConference = isConference;
maybeLoadCannedSmsResponses();
@@ -360,8 +396,8 @@
return mGatewayInfo;
}
- Subscription getSubscription() {
- return mSubscription;
+ PhoneAccount getAccount() {
+ return mAccount;
}
boolean isIncoming() {
@@ -728,7 +764,7 @@
mGatewayInfo.getOriginalHandle());
}
- return new CallInfo(callId, mState, mHandle, mGatewayInfo, mSubscription,
+ return new CallInfo(callId, mState, mHandle, mGatewayInfo, mAccount,
extras, descriptor);
}
@@ -991,6 +1027,10 @@
personUri,
sPhotoLoadListener,
this);
+ } else {
+ for (Listener l : mListeners) {
+ l.onCallerInfoChanged(this);
+ }
}
processDirectToVoicemail();
@@ -1008,6 +1048,10 @@
if (mQueryToken == token) {
mCallerInfo.cachedPhoto = photo;
mCallerInfo.cachedPhotoIcon = photoIcon;
+
+ for (Listener l : mListeners) {
+ l.onCallerInfoChanged(this);
+ }
}
}
diff --git a/src/com/android/telecomm/CallLogManager.java b/src/com/android/telecomm/CallLogManager.java
index 53d2072..906ecd4 100644
--- a/src/com/android/telecomm/CallLogManager.java
+++ b/src/com/android/telecomm/CallLogManager.java
@@ -21,14 +21,11 @@
import android.os.AsyncTask;
import android.provider.CallLog.Calls;
import android.telecomm.CallState;
-import android.telecomm.Subscription;
+import android.telecomm.PhoneAccount;
import android.telephony.PhoneNumberUtils;
import com.android.internal.telephony.PhoneConstants;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-
/**
* Helper class that provides functionality to write information about calls and their associated
* caller details to the call log. All logging activity will be performed asynchronously in a
@@ -49,14 +46,14 @@
* @param durationInMillis Duration of the call (milliseconds).
*/
public AddCallArgs(Context context, ContactInfo contactInfo, String number,
- int presentation, int callType, Subscription subscription,
+ int presentation, int callType, PhoneAccount account,
long creationDate, long durationInMillis) {
this.context = context;
this.contactInfo = contactInfo;
this.number = number;
this.presentation = presentation;
this.callType = callType;
- this.subscription = subscription;
+ this.mAccount = account;
this.timestamp = creationDate;
this.durationInSec = (int)(durationInMillis / 1000);
}
@@ -67,7 +64,7 @@
public final String number;
public final int presentation;
public final int callType;
- public final Subscription subscription;
+ public final PhoneAccount mAccount;
public final long timestamp;
public final int durationInSec;
}
@@ -115,9 +112,9 @@
Log.d(TAG, "logNumber set to: %s", Log.pii(logNumber));
final int presentation = getPresentation(call, contactInfo);
- final Subscription subscription = call.getSubscription();
+ final PhoneAccount account = call.getAccount();
- logCall(contactInfo, logNumber, presentation, callLogType, subscription, creationTime, age);
+ logCall(contactInfo, logNumber, presentation, callLogType, account, creationTime, age);
}
/**
@@ -135,7 +132,7 @@
String number,
int presentation,
int callType,
- Subscription subscription,
+ PhoneAccount account,
long start,
long duration) {
boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(mContext, number);
@@ -154,7 +151,7 @@
+ Log.pii(number) + "," + presentation + ", " + callType
+ ", " + start + ", " + duration);
AddCallArgs args = new AddCallArgs(mContext, contactInfo, number, presentation,
- callType, subscription, start, duration);
+ callType, account, start, duration);
logCallAsync(args);
} else {
Log.d(TAG, "Not adding emergency call to call log.");
@@ -226,7 +223,7 @@
try {
// May block.
result[i] = Calls.addCall(null, c.context, c.number, c.presentation,
- c.callType, c.subscription, c.timestamp, c.durationInSec);
+ c.callType, c.mAccount, c.timestamp, c.durationInSec);
} catch (Exception e) {
// This is very rare but may happen in legitimate cases.
// E.g. If the phone is encrypted and thus write request fails, it may cause
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index cd5cb2a..0446f43 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -23,7 +23,7 @@
import android.telecomm.CallServiceDescriptor;
import android.telecomm.CallState;
import android.telecomm.GatewayInfo;
-import android.telecomm.Subscription;
+import android.telecomm.PhoneAccount;
import android.telephony.DisconnectCause;
import com.google.common.base.Preconditions;
@@ -44,7 +44,7 @@
* access from other packages specifically refraining from passing the CallsManager instance
* beyond the com.android.telecomm package boundary.
*/
-public final class CallsManager implements Call.Listener {
+public final class CallsManager extends Call.ListenerBase {
// TODO(santoscordon): Consider renaming this CallsManagerPlugin.
interface CallsManagerListener {
@@ -304,7 +304,7 @@
* @param speakerphoneOn Whether or not to turn the speakerphone on once the call connects.
*/
void placeOutgoingCall(Uri handle, ContactInfo contactInfo, GatewayInfo gatewayInfo,
- Subscription subscription, boolean speakerphoneOn) {
+ PhoneAccount account, boolean speakerphoneOn) {
final Uri uriHandle = (gatewayInfo == null) ? handle : gatewayInfo.getGatewayHandle();
if (gatewayInfo == null) {
@@ -315,7 +315,7 @@
}
Call call = new Call(
- uriHandle, gatewayInfo, subscription,
+ uriHandle, gatewayInfo, account,
false /* isIncoming */, false /* isConference */);
call.setStartWithSpeakerphoneOn(speakerphoneOn);
@@ -497,7 +497,7 @@
// service.
Call tempCall = new Call(
originalCall.getHandoffHandle(), originalCall.getGatewayInfo(),
- originalCall.getSubscription(), false, false);
+ originalCall.getAccount(), false, false);
tempCall.setOriginalCall(originalCall);
tempCall.setExtras(originalCall.getExtras());
mPendingHandoffCalls.add(tempCall);
diff --git a/src/com/android/telecomm/InCallController.java b/src/com/android/telecomm/InCallController.java
index 90d24fd..9b53609 100644
--- a/src/com/android/telecomm/InCallController.java
+++ b/src/com/android/telecomm/InCallController.java
@@ -320,7 +320,7 @@
return new InCallCall(callId, state, call.getDisconnectCause(), call.getDisconnectMessage(),
call.getCannedSmsResponses(), capabilities, connectTimeMillis, call.getHandle(),
- call.getGatewayInfo(), call.getSubscription(), descriptor,
+ call.getGatewayInfo(), call.getAccount(), descriptor,
call.getHandoffCallServiceDescriptor(), call.getCallVideoProvider(),
parentCallId, childCallIds, call.getFeatures());
}
diff --git a/src/com/android/telecomm/MissedCallNotifier.java b/src/com/android/telecomm/MissedCallNotifier.java
index 79c9c0f..f0f5217 100644
--- a/src/com/android/telecomm/MissedCallNotifier.java
+++ b/src/com/android/telecomm/MissedCallNotifier.java
@@ -20,9 +20,11 @@
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.TaskStackBuilder;
+import android.content.AsyncQueryHandler;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
+import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
@@ -42,6 +44,14 @@
*/
class MissedCallNotifier extends CallsManagerListenerBase {
+ private static final String[] CALL_LOG_PROJECTION = new String[] {
+ Calls._ID,
+ Calls.NUMBER,
+ Calls.NUMBER_PRESENTATION,
+ Calls.DATE,
+ Calls.DURATION,
+ Calls.TYPE,
+ };
private static final int MISSED_CALL_NOTIFICATION_ID = 1;
private static final String SCHEME_SMSTO = "smsto";
@@ -55,6 +65,8 @@
mContext = context;
mNotificationManager =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
+
+ updateOnStartup();
}
/** {@inheritDoc} */
@@ -243,4 +255,53 @@
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.defaults |= Notification.DEFAULT_LIGHTS;
}
+
+ /**
+ * Adds the missed call notification on startup if there are unread missed calls.
+ */
+ private void updateOnStartup() {
+ Log.d(this, "updateOnStartup()...");
+
+ // instantiate query handler
+ AsyncQueryHandler queryHandler = new AsyncQueryHandler(mContext.getContentResolver()) {
+ @Override
+ protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
+ if (cursor != null) {
+ while (cursor.moveToNext()) {
+ // Get data about the missed call from the cursor
+ Uri handle = Uri.parse(cursor.getString(
+ cursor.getColumnIndexOrThrow(Calls.NUMBER)));
+
+ // Convert the data to a call object
+ Call call = new Call(null, null, null, true, false);
+ call.setDisconnectCause(DisconnectCause.INCOMING_MISSED, "");
+ call.setState(CallState.DISCONNECTED);
+
+ // Listen for the update to the caller information before posting the
+ // notification so that we have the contact info and photo.
+ call.addListener(new Call.ListenerBase() {
+ @Override
+ public void onCallerInfoChanged(Call call) {
+ call.removeListener(this); // No longer need to listen to call
+ // changes after the contact info
+ // is retrieved.
+ showMissedCallNotification(call);
+ }
+ });
+ // Set the handle here because that is what triggers the contact info query.
+ call.setHandle(handle);
+ }
+ }
+ }
+ };
+
+ // setup query spec, look for all Missed calls that are new.
+ StringBuilder where = new StringBuilder("type=");
+ where.append(Calls.MISSED_TYPE);
+ where.append(" AND new=1");
+
+ // start the query
+ queryHandler.startQuery(0, null, Calls.CONTENT_URI, CALL_LOG_PROJECTION,
+ where.toString(), null, Calls.DEFAULT_SORT_ORDER);
+ }
}
diff --git a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
index c18dbc5..770b75d 100644
--- a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
+++ b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
@@ -17,34 +17,18 @@
package com.android.telecomm;
import android.app.Activity;
-import android.app.ActivityManagerNative;
-import android.app.AlertDialog;
-import android.app.AppOpsManager;
-import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
-import android.content.res.Configuration;
import android.content.res.Resources;
-import android.database.Cursor;
import android.net.Uri;
-import android.os.Binder;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.os.RemoteException;
-import android.os.SystemProperties;
import android.os.UserHandle;
-import android.provider.ContactsContract;
import android.telecomm.GatewayInfo;
-import android.telecomm.Subscription;
+import android.telecomm.PhoneAccount;
import android.telecomm.TelecommConstants;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
-import android.view.View;
-import android.widget.ProgressBar;
/**
* OutgoingCallIntentBroadcaster receives CALL and CALL_PRIVILEGED Intents, and broadcasts the
@@ -135,9 +119,9 @@
}
GatewayInfo gatewayInfo = getGateWayInfoFromIntent(intent, resultHandleUri);
- Subscription subscription = getSubscriptionFromIntent(intent);
+ PhoneAccount account = getAccountFromIntent(intent);
mCallsManager.placeOutgoingCall(resultHandleUri, mContactInfo, gatewayInfo,
- subscription,
+ account,
mIntent.getBooleanExtra(TelecommConstants.EXTRA_START_CALL_WITH_SPEAKERPHONE,
false));
}
@@ -276,11 +260,11 @@
Log.d(this, "Found and copied gateway provider extras to broadcast intent.");
return;
}
- Subscription extraSubscription = src.getParcelableExtra(
- TelephonyManager.EXTRA_SUBSCRIPTION);
- if (extraSubscription != null) {
- dst.putExtra(TelephonyManager.EXTRA_SUBSCRIPTION, extraSubscription);
- Log.d(this, "Found and copied subscription extra to broadcast intent.");
+ PhoneAccount extraAccount = src.getParcelableExtra(
+ TelephonyManager.EXTRA_ACCOUNT);
+ if (extraAccount != null) {
+ dst.putExtra(TelephonyManager.EXTRA_ACCOUNT, extraAccount);
+ Log.d(this, "Found and copied account extra to broadcast intent.");
}
Log.d(this, "No provider extras found in call intent.");
@@ -327,17 +311,17 @@
}
/**
- * Extracts subscription/connection provider information from a provided intent..
+ * Extracts account/connection provider information from a provided intent..
*
- * @param intent to extract subscription information from.
- * @return Subscription object containing extracted subscription information
+ * @param intent to extract account information from.
+ * @return Account object containing extracted account information
*/
- public static Subscription getSubscriptionFromIntent(Intent intent) {
+ public static PhoneAccount getAccountFromIntent(Intent intent) {
if (intent == null) {
return null;
}
- return intent.getParcelableExtra(TelephonyManager.EXTRA_SUBSCRIPTION);
+ return intent.getParcelableExtra(TelephonyManager.EXTRA_ACCOUNT);
}
private void launchSystemDialer(Context context, Uri handle) {
diff --git a/src/com/android/telecomm/TelecommApp.java b/src/com/android/telecomm/TelecommApp.java
index 7f477f9..37c7aa0 100644
--- a/src/com/android/telecomm/TelecommApp.java
+++ b/src/com/android/telecomm/TelecommApp.java
@@ -40,7 +40,7 @@
mMissedCallNotifier = new MissedCallNotifier(this);
if (UserHandle.myUserId() == UserHandle.USER_OWNER) {
- TelecommServiceImpl.init();
+ TelecommServiceImpl.init(mMissedCallNotifier);
}
}
diff --git a/src/com/android/telecomm/TelecommServiceImpl.java b/src/com/android/telecomm/TelecommServiceImpl.java
index d0b8676..ca80e8a 100644
--- a/src/com/android/telecomm/TelecommServiceImpl.java
+++ b/src/com/android/telecomm/TelecommServiceImpl.java
@@ -21,6 +21,7 @@
import com.android.internal.telecomm.ITelecommService;
import android.content.ComponentName;
+import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Handler;
@@ -28,8 +29,8 @@
import android.os.Message;
import android.os.ServiceManager;
import android.telecomm.CallState;
-import android.telecomm.Subscription;
import android.text.TextUtils;
+import android.telecomm.PhoneAccount;
import java.util.List;
@@ -76,6 +77,9 @@
case MSG_ACCEPT_RINGING_CALL:
acceptRingingCallInternal();
break;
+ case MSG_CANCEL_MISSED_CALLS_NOTIFICATION:
+ mMissedCallNotifier.clearMissedCalls();
+ break;
}
if (result != null) {
@@ -99,15 +103,17 @@
private static final int MSG_IS_RINGING = 4;
private static final int MSG_END_CALL = 5;
private static final int MSG_ACCEPT_RINGING_CALL = 6;
+ private static final int MSG_CANCEL_MISSED_CALLS_NOTIFICATION = 7;
/** The singleton instance. */
private static TelecommServiceImpl sInstance;
private final CallsManager mCallsManager = CallsManager.getInstance();
-
+ private final MissedCallNotifier mMissedCallNotifier;
private final MainThreadHandler mMainThreadHandler = new MainThreadHandler();
- private TelecommServiceImpl() {
+ private TelecommServiceImpl(MissedCallNotifier missedCallNotifier) {
+ mMissedCallNotifier = missedCallNotifier;
publish();
}
@@ -115,10 +121,10 @@
* Initialize the singleton TelecommServiceImpl instance.
* This is only done once, at startup, from TelecommApp.onCreate().
*/
- static TelecommServiceImpl init() {
+ static TelecommServiceImpl init(MissedCallNotifier missedCallNotifier) {
synchronized (TelecommServiceImpl.class) {
if (sInstance == null) {
- sInstance = new TelecommServiceImpl();
+ sInstance = new TelecommServiceImpl(missedCallNotifier);
} else {
Log.wtf(TAG, "init() called multiple times! sInstance %s", sInstance);
}
@@ -131,18 +137,57 @@
//
@Override
- public List<Subscription> getSubscriptions() {
- return sSubscriptions;
+ public List<PhoneAccount> getAccounts() {
+ // TODO (STOPSHIP): Static list of Accounts for testing and UX work only.
+ ComponentName componentName = new ComponentName(
+ "com.android.telecomm",
+ TelecommServiceImpl.class.getName()); // This field is a no-op
+ Context app = TelecommApp.getInstance();
+
+ return Lists.newArrayList(
+ new PhoneAccount(
+ componentName,
+ "account0",
+ Uri.parse("tel:999-555-1212"),
+ app.getString(R.string.test_account_0_label),
+ app.getString(R.string.test_account_0_short_description),
+ true,
+ true),
+ new PhoneAccount(
+ componentName,
+ "account1",
+ Uri.parse("tel:333-111-2222"),
+ app.getString(R.string.test_account_1_label),
+ app.getString(R.string.test_account_1_short_description),
+ true,
+ false),
+ new PhoneAccount(
+ componentName,
+ "account2",
+ Uri.parse("mailto:two@example.com"),
+ app.getString(R.string.test_account_2_label),
+ app.getString(R.string.test_account_2_short_description),
+ true,
+ false),
+ new PhoneAccount(
+ componentName,
+ "account3",
+ Uri.parse("mailto:three@example.com"),
+ app.getString(R.string.test_account_3_label),
+ app.getString(R.string.test_account_3_short_description),
+ true,
+ false)
+ );
}
@Override
- public void setEnabled(Subscription subscription, boolean enabled) {
+ public void setEnabled(PhoneAccount account, boolean enabled) {
// Enforce MODIFY_PHONE_STATE ?
// TODO
}
@Override
- public void setSystemDefault(Subscription subscription) {
+ public void setSystemDefault(PhoneAccount account) {
// Enforce MODIFY_PHONE_STATE ?
// TODO
}
@@ -206,8 +251,12 @@
@Override
public void showCallScreen(boolean showDialpad) {
- mMainThreadHandler.obtainMessage(MSG_SHOW_CALL_SCREEN, showDialpad ? 1 : 0, 0)
- .sendToTarget();
+ sendRequestAsync(MSG_SHOW_CALL_SCREEN, showDialpad ? 1 : 0);
+ }
+
+ @Override
+ public void cancelMissedCallsNotification() {
+ sendRequestAsync(MSG_CANCEL_MISSED_CALLS_NOTIFICATION, 0);
}
//
@@ -260,50 +309,9 @@
android.Manifest.permission.READ_PHONE_STATE, null);
}
- // TODO (STOPSHIP): Static list of Subscriptions for testing and UX work only.
-
- private static final ComponentName sComponentName = new ComponentName(
- "com.android.telecomm",
- TelecommServiceImpl.class.getName()); // This field is a no-op
-
- private static final List<Subscription> sSubscriptions = Lists.newArrayList(
- new Subscription(
- sComponentName,
- "subscription0",
- Uri.parse("tel:999-555-1212"),
- R.string.test_subscription_0_label,
- R.string.test_subscription_0_short_description,
- R.drawable.q_mobile,
- true,
- true),
- new Subscription(
- sComponentName,
- "subscription1",
- Uri.parse("tel:333-111-2222"),
- R.string.test_subscription_1_label,
- R.string.test_subscription_1_short_description,
- R.drawable.market_wireless,
- true,
- false),
- new Subscription(
- sComponentName,
- "subscription2",
- Uri.parse("mailto:two@example.com"),
- R.string.test_subscription_2_label,
- R.string.test_subscription_2_short_description,
- R.drawable.talk_to_your_circles,
- true,
- false),
- new Subscription(
- sComponentName,
- "subscription3",
- Uri.parse("mailto:three@example.com"),
- R.string.test_subscription_3_label,
- R.string.test_subscription_3_short_description,
- R.drawable.chat_with_others,
- true,
- false)
- );
+ private void showCallScreenInternal(boolean showDialpad) {
+ CallsManager.getInstance().getInCallController().bringToForeground(showDialpad);
+ }
private void publish() {
Log.d(this, "publish: %s", this);
diff --git a/tests/src/com/android/telecomm/testapps/TestConnectionService.java b/tests/src/com/android/telecomm/testapps/TestConnectionService.java
index af9622f..241f8ee 100644
--- a/tests/src/com/android/telecomm/testapps/TestConnectionService.java
+++ b/tests/src/com/android/telecomm/testapps/TestConnectionService.java
@@ -28,7 +28,7 @@
import android.telecomm.RemoteConnection;
import android.telecomm.Response;
import android.telecomm.SimpleResponse;
-import android.telecomm.Subscription;
+import android.telecomm.PhoneAccount;
import android.telephony.DisconnectCause;
import android.text.TextUtils;
import android.util.Log;
@@ -196,15 +196,15 @@
}
private class CallAttempter implements OutgoingCallResponse<RemoteConnection> {
- private final Iterator<Subscription> mSubscriptionIterator;
+ private final Iterator<PhoneAccount> mAccountIterator;
private final OutgoingCallResponse<Connection> mCallback;
private final ConnectionRequest mOriginalRequest;
CallAttempter(
- Iterator<Subscription> iterator,
+ Iterator<PhoneAccount> iterator,
OutgoingCallResponse<Connection> callback,
ConnectionRequest originalRequest) {
- mSubscriptionIterator = iterator;
+ mAccountIterator = iterator;
mCallback = callback;
mOriginalRequest = originalRequest;
}
@@ -217,23 +217,23 @@
mCalls.add(connection);
mCallback.onSuccess(mOriginalRequest, connection);
} else {
- tryNextSubscription();
+ tryNextAccount();
}
}
@Override
public void onFailure(ConnectionRequest request, int code, String msg) {
- tryNextSubscription();
+ tryNextAccount();
}
@Override
public void onCancel(ConnectionRequest request) {
}
- public void tryNextSubscription() {
- if (mSubscriptionIterator.hasNext()) {
+ public void tryNextAccount() {
+ if (mAccountIterator.hasNext()) {
ConnectionRequest connectionRequest = new ConnectionRequest(
- mSubscriptionIterator.next(),
+ mAccountIterator.next(),
mOriginalRequest.getCallId(),
mOriginalRequest.getHandle(),
null);
@@ -323,26 +323,25 @@
// If the number starts with 555, then we handle it ourselves. If not, then we
// use a remote connection service.
- // TODO(santoscordon): Have a special phone number to test the subscription-picker dialog
- // flow.
+ // TODO(santoscordon): Have a special phone number to test the account-picker dialog flow.
if (number.startsWith("555")) {
TestConnection connection = new TestConnection(null, Connection.State.DIALING);
mCalls.add(connection);
callback.onSuccess(request, connection);
connection.startOutgoing();
} else {
- log("looking up subscriptions");
- lookupRemoteSubscriptions(handle, new SimpleResponse<Uri, List<Subscription>>() {
+ log("looking up accounts");
+ lookupRemoteAccounts(handle, new SimpleResponse<Uri, List<PhoneAccount>>() {
@Override
- public void onResult(Uri handle, final List<Subscription> subscriptions) {
- log("starting the call attempter with subscriptions: " + subscriptions);
- new CallAttempter(subscriptions.iterator(), callback, request)
- .tryNextSubscription();
+ public void onResult(Uri handle, final List<PhoneAccount> accounts) {
+ log("starting the call attempter with accounts: " + accounts);
+ new CallAttempter(accounts.iterator(), callback, request)
+ .tryNextAccount();
}
@Override
public void onError(Uri handle) {
- log("remote subscription lookup failed.");
+ log("remote account lookup failed.");
callback.onFailure(request, 0, null);
}
});