diff options
author | Ihab Awad <ihab@google.com> | 2014-06-30 21:27:28 -0700 |
---|---|---|
committer | Ihab Awad <ihab@google.com> | 2014-07-01 17:42:03 -0700 |
commit | 98a556026109f816501fa887efdddae78d0c2d65 (patch) | |
tree | 47b3544e6d597035d85747467c0c972eb8c1c098 | |
parent | 417b2376e24bd8906fd4fce40d2f06f4680e49f4 (diff) | |
download | android_packages_services_Telecomm-98a556026109f816501fa887efdddae78d0c2d65.tar.gz android_packages_services_Telecomm-98a556026109f816501fa887efdddae78d0c2d65.tar.bz2 android_packages_services_Telecomm-98a556026109f816501fa887efdddae78d0c2d65.zip |
Rename Telecomm "Subscription" to "Account" (6/7)
Change-Id: I9458216c06e7bbb68ef27e8b084f18e6c7f2fc8b
-rw-r--r-- | res/drawable-xxhdpi/chat_with_others.png | bin | 9306 -> 0 bytes | |||
-rw-r--r-- | res/drawable-xxhdpi/market_wireless.png | bin | 9774 -> 0 bytes | |||
-rw-r--r-- | res/drawable-xxhdpi/q_mobile.png | bin | 7924 -> 0 bytes | |||
-rw-r--r-- | res/drawable-xxhdpi/talk_to_your_circles.png | bin | 10162 -> 0 bytes | |||
-rw-r--r-- | res/values/strings.xml | 16 | ||||
-rw-r--r-- | src/com/android/telecomm/Call.java | 16 | ||||
-rw-r--r-- | src/com/android/telecomm/CallLogManager.java | 21 | ||||
-rw-r--r-- | src/com/android/telecomm/CallsManager.java | 8 | ||||
-rw-r--r-- | src/com/android/telecomm/InCallController.java | 2 | ||||
-rw-r--r-- | src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java | 42 | ||||
-rw-r--r-- | src/com/android/telecomm/TelecommServiceImpl.java | 97 | ||||
-rw-r--r-- | tests/src/com/android/telecomm/testapps/TestConnectionService.java | 35 |
12 files changed, 108 insertions, 129 deletions
diff --git a/res/drawable-xxhdpi/chat_with_others.png b/res/drawable-xxhdpi/chat_with_others.png Binary files differdeleted file mode 100644 index 6f6b03ee..00000000 --- a/res/drawable-xxhdpi/chat_with_others.png +++ /dev/null diff --git a/res/drawable-xxhdpi/market_wireless.png b/res/drawable-xxhdpi/market_wireless.png Binary files differdeleted file mode 100644 index e451fe7f..00000000 --- a/res/drawable-xxhdpi/market_wireless.png +++ /dev/null diff --git a/res/drawable-xxhdpi/q_mobile.png b/res/drawable-xxhdpi/q_mobile.png Binary files differdeleted file mode 100644 index cfc0624b..00000000 --- a/res/drawable-xxhdpi/q_mobile.png +++ /dev/null diff --git a/res/drawable-xxhdpi/talk_to_your_circles.png b/res/drawable-xxhdpi/talk_to_your_circles.png Binary files differdeleted file mode 100644 index d6bc6727..00000000 --- a/res/drawable-xxhdpi/talk_to_your_circles.png +++ /dev/null diff --git a/res/values/strings.xml b/res/values/strings.xml index e85d7b6c..eddeec52 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 ddd4b1d9..0771df9d 100644 --- a/src/com/android/telecomm/Call.java +++ b/src/com/android/telecomm/Call.java @@ -27,8 +27,8 @@ import android.telecomm.CallInfo; 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; @@ -117,7 +117,7 @@ final class Call implements OutgoingCallResponse { * service. */ private final GatewayInfo mGatewayInfo; - private final Subscription mSubscription; + private final PhoneAccount mAccount; private final Handler mHandler = new Handler(); @@ -226,15 +226,15 @@ final class Call implements OutgoingCallResponse { * * @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 +360,8 @@ final class Call implements OutgoingCallResponse { return mGatewayInfo; } - Subscription getSubscription() { - return mSubscription; + PhoneAccount getAccount() { + return mAccount; } boolean isIncoming() { @@ -728,7 +728,7 @@ final class Call implements OutgoingCallResponse { mGatewayInfo.getOriginalHandle()); } - return new CallInfo(callId, mState, mHandle, mGatewayInfo, mSubscription, + return new CallInfo(callId, mState, mHandle, mGatewayInfo, mAccount, extras, descriptor); } diff --git a/src/com/android/telecomm/CallLogManager.java b/src/com/android/telecomm/CallLogManager.java index 53d2072b..906ecd41 100644 --- a/src/com/android/telecomm/CallLogManager.java +++ b/src/com/android/telecomm/CallLogManager.java @@ -21,14 +21,11 @@ import android.net.Uri; 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 @@ final class CallLogManager extends CallsManagerListenerBase { * @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 @@ final class CallLogManager extends CallsManagerListenerBase { 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 @@ final class CallLogManager extends CallsManagerListenerBase { 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 @@ final class CallLogManager extends CallsManagerListenerBase { String number, int presentation, int callType, - Subscription subscription, + PhoneAccount account, long start, long duration) { boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(mContext, number); @@ -154,7 +151,7 @@ final class CallLogManager extends CallsManagerListenerBase { + 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 @@ final class CallLogManager extends CallsManagerListenerBase { 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 cd5cb2a4..664fc554 100644 --- a/src/com/android/telecomm/CallsManager.java +++ b/src/com/android/telecomm/CallsManager.java @@ -23,7 +23,7 @@ import android.telecomm.CallInfo; 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; @@ -304,7 +304,7 @@ public final class CallsManager implements Call.Listener { * @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 @@ public final class CallsManager implements Call.Listener { } Call call = new Call( - uriHandle, gatewayInfo, subscription, + uriHandle, gatewayInfo, account, false /* isIncoming */, false /* isConference */); call.setStartWithSpeakerphoneOn(speakerphoneOn); @@ -497,7 +497,7 @@ public final class CallsManager implements Call.Listener { // 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 90d24fd2..9b536099 100644 --- a/src/com/android/telecomm/InCallController.java +++ b/src/com/android/telecomm/InCallController.java @@ -320,7 +320,7 @@ public final class InCallController extends CallsManagerListenerBase { 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/NewOutgoingCallIntentBroadcaster.java b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java index c18dbc5f..770b75db 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 @@ class NewOutgoingCallIntentBroadcaster { } 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 @@ class NewOutgoingCallIntentBroadcaster { 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 @@ class NewOutgoingCallIntentBroadcaster { } /** - * 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/TelecommServiceImpl.java b/src/com/android/telecomm/TelecommServiceImpl.java index 24d6cc42..6ba90d0a 100644 --- a/src/com/android/telecomm/TelecommServiceImpl.java +++ b/src/com/android/telecomm/TelecommServiceImpl.java @@ -21,6 +21,7 @@ import com.google.android.collect.Lists; 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.Looper; 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; @@ -131,18 +132,57 @@ public class TelecommServiceImpl extends ITelecommService.Stub { // @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 } @@ -260,50 +300,9 @@ public class TelecommServiceImpl extends ITelecommService.Stub { 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 af9622fc..241f8ee6 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.ConnectionService; 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 @@ public class TestConnectionService extends ConnectionService { } 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 @@ public class TestConnectionService extends ConnectionService { 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 @@ public class TestConnectionService extends ConnectionService { // 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); } }); |