diff options
author | Ihab Awad <ihab@google.com> | 2014-07-02 19:55:51 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-02 18:22:50 +0000 |
commit | ad4cc9ba380b1c76eff4e63bae53cbb12a3121c1 (patch) | |
tree | fd1d1d7970c9ad9060782c05d9bcf735d1c078e0 /telecomm | |
parent | 69ea13ea7135525e7c8444fc6c844a9e760ec37d (diff) | |
parent | 9c3f18846aaa9340cc222f825c9c32ec42f9d0c9 (diff) | |
download | frameworks_base-ad4cc9ba380b1c76eff4e63bae53cbb12a3121c1.zip frameworks_base-ad4cc9ba380b1c76eff4e63bae53cbb12a3121c1.tar.gz frameworks_base-ad4cc9ba380b1c76eff4e63bae53cbb12a3121c1.tar.bz2 |
Merge "Rename Telecomm "Subscription" to "Account" (1/7)"
Diffstat (limited to 'telecomm')
-rw-r--r-- | telecomm/java/android/telecomm/CallInfo.java | 26 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/ConnectionRequest.java | 10 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/ConnectionService.java | 40 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/InCallCall.java | 18 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/PhoneAccount.aidl (renamed from telecomm/java/android/telecomm/Subscription.aidl) | 2 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/PhoneAccount.java (renamed from telecomm/java/android/telecomm/Subscription.java) | 69 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/RemoteConnectionManager.java | 23 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/RemoteConnectionService.java | 15 | ||||
-rw-r--r-- | telecomm/java/com/android/internal/telecomm/ITelecommService.aidl | 14 |
9 files changed, 105 insertions, 112 deletions
diff --git a/telecomm/java/android/telecomm/CallInfo.java b/telecomm/java/android/telecomm/CallInfo.java index 17efed5..3810d7c 100644 --- a/telecomm/java/android/telecomm/CallInfo.java +++ b/telecomm/java/android/telecomm/CallInfo.java @@ -21,8 +21,6 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; -import java.util.Date; - /** * A parcelable holder class of Call information data. This class is intended for transferring call * information from Telecomm to call services and thus is read-only. @@ -52,9 +50,9 @@ public final class CallInfo implements Parcelable { private final GatewayInfo mGatewayInfo; /** - * Subscription information for the call. + * Account information for the call. */ - private final Subscription mSubscription; + private final PhoneAccount mAccount; /** * Additional information that can be persisted. @@ -75,7 +73,7 @@ public final class CallInfo implements Parcelable { * @param state The state of the call. * @param handle The handle to the other party in this call. * @param gatewayInfo Gateway information pertaining to this call. - * @param subscription Subscription information pertaining to this call. + * @param account Account information pertaining to this call. * @param extras Additional information that can be persisted. * @param currentCallServiceDescriptor The descriptor for the call service currently routing * this call. @@ -87,14 +85,14 @@ public final class CallInfo implements Parcelable { CallState state, Uri handle, GatewayInfo gatewayInfo, - Subscription subscription, + PhoneAccount account, Bundle extras, CallServiceDescriptor currentCallServiceDescriptor) { mId = id; mState = state; mHandle = handle; mGatewayInfo = gatewayInfo; - mSubscription = subscription; + mAccount = account; mExtras = extras; mCurrentCallServiceDescriptor = currentCallServiceDescriptor; } @@ -127,8 +125,8 @@ public final class CallInfo implements Parcelable { return mGatewayInfo; } - public Subscription getSubscription() { - return mSubscription; + public PhoneAccount getAccount() { + return mAccount; } public Bundle getExtras() { @@ -150,12 +148,12 @@ public final class CallInfo implements Parcelable { Uri handle = Uri.CREATOR.createFromParcel(source); GatewayInfo gatewayInfo = readProviderInfoIfExists(source, GatewayInfo.CREATOR); - Subscription subscription = readProviderInfoIfExists(source, Subscription.CREATOR); + PhoneAccount account = readProviderInfoIfExists(source, PhoneAccount.CREATOR); ClassLoader classLoader = CallInfo.class.getClassLoader(); Bundle extras = source.readParcelable(classLoader); CallServiceDescriptor descriptor = source.readParcelable(classLoader); - return new CallInfo(id, state, handle, gatewayInfo, subscription, extras, descriptor); + return new CallInfo(id, state, handle, gatewayInfo, account, extras, descriptor); } @Override @@ -182,14 +180,14 @@ public final class CallInfo implements Parcelable { mHandle.writeToParcel(destination, 0); writeProviderInfoIfExists(destination, mGatewayInfo); - writeProviderInfoIfExists(destination, mSubscription); + writeProviderInfoIfExists(destination, mAccount); destination.writeParcelable(mExtras, 0); destination.writeParcelable(mCurrentCallServiceDescriptor, 0); } /** - * Helper function to write provider information (either GatewayInfo or Subscription) to + * Helper function to write provider information (either GatewayInfo or Account) to * parcel. Will write a false byte if the information does not exist. */ private void writeProviderInfoIfExists(Parcel destination, Parcelable provider) { @@ -202,7 +200,7 @@ public final class CallInfo implements Parcelable { } /** - * Helper function to read provider information (either GatewayInfo or Subscription) from + * Helper function to read provider information (either GatewayInfo or Account) from * parcel. */ private static <T> T readProviderInfoIfExists(Parcel source, diff --git a/telecomm/java/android/telecomm/ConnectionRequest.java b/telecomm/java/android/telecomm/ConnectionRequest.java index 61ac816..a9aa5dd 100644 --- a/telecomm/java/android/telecomm/ConnectionRequest.java +++ b/telecomm/java/android/telecomm/ConnectionRequest.java @@ -33,7 +33,7 @@ public final class ConnectionRequest implements Parcelable { private final String mCallId; private final Uri mHandle; private final Bundle mExtras; - private final Subscription mSubscription; + private final PhoneAccount mAccount; public ConnectionRequest(Uri handle, Bundle extras) { this(null, handle, extras); @@ -43,17 +43,17 @@ public final class ConnectionRequest implements Parcelable { this(null, callId, handle, extras); } - public ConnectionRequest(Subscription subscription, String callId, Uri handle, Bundle extras) { + public ConnectionRequest(PhoneAccount account, String callId, Uri handle, Bundle extras) { mCallId = callId; mHandle = handle; mExtras = extras; - mSubscription = subscription; + mAccount = account; } /** - * The subscription which should be used to place the call. + * The account which should be used to place the call. */ - public Subscription getSubscription() { return mSubscription; } + public PhoneAccount getAccount() { return mAccount; } /** * An identifier for this call. diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java index 530e977..693e9fb 100644 --- a/telecomm/java/android/telecomm/ConnectionService.java +++ b/telecomm/java/android/telecomm/ConnectionService.java @@ -48,9 +48,9 @@ public abstract class ConnectionService extends CallService { private final RemoteConnectionManager mRemoteConnectionManager = new RemoteConnectionManager(); private final Handler mHandler = new Handler(Looper.getMainLooper()); - private SimpleResponse<Uri, List<Subscription>> mSubscriptionLookupResponse; - private Uri mSubscriptionLookupHandle; - private boolean mAreSubscriptionsInitialized = false; + private SimpleResponse<Uri, List<PhoneAccount>> mAccountLookupResponse; + private Uri mAccountLookupHandle; + private boolean mAreAccountsInitialized = false; /** * A callback for providing the resuilt of creating a connection. @@ -382,7 +382,7 @@ public abstract class ConnectionService extends CallService { */ @Override protected final void onAdapterAttached(CallServiceAdapter adapter) { - if (mAreSubscriptionsInitialized) { + if (mAreAccountsInitialized) { // No need to query again if we already did it. return; } @@ -399,9 +399,9 @@ public abstract class ConnectionService extends CallService { componentNames.get(i), ICallService.Stub.asInterface(callServices.get(i))); } - mAreSubscriptionsInitialized = true; + mAreAccountsInitialized = true; Log.d(this, "remote call services found: " + callServices); - maybeRespondToSubscriptionLookup(); + maybeRespondToAccountLookup(); } }); } @@ -410,29 +410,29 @@ public abstract class ConnectionService extends CallService { public void onError() { mHandler.post(new Runnable() { @Override public void run() { - mAreSubscriptionsInitialized = true; - maybeRespondToSubscriptionLookup(); + mAreAccountsInitialized = true; + maybeRespondToAccountLookup(); } }); } }); } - public final void lookupRemoteSubscriptions( - Uri handle, SimpleResponse<Uri, List<Subscription>> response) { - mSubscriptionLookupResponse = response; - mSubscriptionLookupHandle = handle; - maybeRespondToSubscriptionLookup(); + public final void lookupRemoteAccounts( + Uri handle, SimpleResponse<Uri, List<PhoneAccount>> response) { + mAccountLookupResponse = response; + mAccountLookupHandle = handle; + maybeRespondToAccountLookup(); } - public final void maybeRespondToSubscriptionLookup() { - if (mAreSubscriptionsInitialized && mSubscriptionLookupResponse != null) { - mSubscriptionLookupResponse.onResult( - mSubscriptionLookupHandle, - mRemoteConnectionManager.getSubscriptions(mSubscriptionLookupHandle)); + public final void maybeRespondToAccountLookup() { + if (mAreAccountsInitialized && mAccountLookupResponse != null) { + mAccountLookupResponse.onResult( + mAccountLookupHandle, + mRemoteConnectionManager.getAccounts(mAccountLookupHandle)); - mSubscriptionLookupHandle = null; - mSubscriptionLookupResponse = null; + mAccountLookupHandle = null; + mAccountLookupResponse = null; } } diff --git a/telecomm/java/android/telecomm/InCallCall.java b/telecomm/java/android/telecomm/InCallCall.java index 44dd567..fc96f55 100644 --- a/telecomm/java/android/telecomm/InCallCall.java +++ b/telecomm/java/android/telecomm/InCallCall.java @@ -41,7 +41,7 @@ public final class InCallCall implements Parcelable { private final long mConnectTimeMillis; private final Uri mHandle; private final GatewayInfo mGatewayInfo; - private final Subscription mSubscription; + private final PhoneAccount mAccount; private final CallServiceDescriptor mCurrentCallServiceDescriptor; private final CallServiceDescriptor mHandoffCallServiceDescriptor; private final ICallVideoProvider mCallVideoProvider; @@ -61,7 +61,7 @@ public final class InCallCall implements Parcelable { long connectTimeMillis, Uri handle, GatewayInfo gatewayInfo, - Subscription subscription, + PhoneAccount subscription, CallServiceDescriptor descriptor, CallServiceDescriptor handoffDescriptor, ICallVideoProvider callVideoProvider, @@ -77,7 +77,7 @@ public final class InCallCall implements Parcelable { mConnectTimeMillis = connectTimeMillis; mHandle = handle; mGatewayInfo = gatewayInfo; - mSubscription = subscription; + mAccount = subscription; mCurrentCallServiceDescriptor = descriptor; mHandoffCallServiceDescriptor = handoffDescriptor; mCallVideoProvider = callVideoProvider; @@ -139,9 +139,9 @@ public final class InCallCall implements Parcelable { return mGatewayInfo; } - /** Subscription information for the call. */ - public Subscription getSubscription() { - return mSubscription; + /** PhoneAccount information for the call. */ + public PhoneAccount getAccount() { + return mAccount; } /** The descriptor for the call service currently routing this call. */ @@ -215,7 +215,7 @@ public final class InCallCall implements Parcelable { long connectTimeMillis = source.readLong(); Uri handle = source.readParcelable(classLoader); GatewayInfo gatewayInfo = source.readParcelable(classLoader); - Subscription subscription = source.readParcelable(classLoader); + PhoneAccount account = source.readParcelable(classLoader); CallServiceDescriptor descriptor = source.readParcelable(classLoader); CallServiceDescriptor handoffDescriptor = source.readParcelable(classLoader); ICallVideoProvider callVideoProvider = @@ -226,7 +226,7 @@ public final class InCallCall implements Parcelable { int features = source.readInt(); return new InCallCall(id, state, disconnectCauseCode, disconnectCauseMsg, cannedSmsResponses, capabilities, connectTimeMillis, handle, gatewayInfo, - subscription, descriptor, handoffDescriptor, callVideoProvider, parentCallId, + account, descriptor, handoffDescriptor, callVideoProvider, parentCallId, childCallIds, features); } @@ -254,7 +254,7 @@ public final class InCallCall implements Parcelable { destination.writeLong(mConnectTimeMillis); destination.writeParcelable(mHandle, 0); destination.writeParcelable(mGatewayInfo, 0); - destination.writeParcelable(mSubscription, 0); + destination.writeParcelable(mAccount, 0); destination.writeParcelable(mCurrentCallServiceDescriptor, 0); destination.writeParcelable(mHandoffCallServiceDescriptor, 0); destination.writeStrongBinder( diff --git a/telecomm/java/android/telecomm/Subscription.aidl b/telecomm/java/android/telecomm/PhoneAccount.aidl index 6327fcc..b98cf41 100644 --- a/telecomm/java/android/telecomm/Subscription.aidl +++ b/telecomm/java/android/telecomm/PhoneAccount.aidl @@ -19,4 +19,4 @@ package android.telecomm; /** * {@hide} */ -parcelable Subscription; +parcelable PhoneAccount; diff --git a/telecomm/java/android/telecomm/Subscription.java b/telecomm/java/android/telecomm/PhoneAccount.java index 964db4a..e972aee 100644 --- a/telecomm/java/android/telecomm/Subscription.java +++ b/telecomm/java/android/telecomm/PhoneAccount.java @@ -30,14 +30,14 @@ import android.util.Log; import java.util.MissingResourceException; /** - * Represents a distinct subscription, line of service or call placement method that + * Represents a distinct account, line of service or call placement method that * the system can use to place phone calls. */ -public class Subscription implements Parcelable { +public class PhoneAccount implements Parcelable { private static final int NO_DENSITY = -1; - private static final String LOG_TAG = "Subscription"; + private static final String LOG_TAG = "Account"; private final ComponentName mComponentName; private final String mId; @@ -48,28 +48,27 @@ public class Subscription implements Parcelable { private final boolean mIsEnabled; private final boolean mIsSystemDefault; - public Subscription( + public PhoneAccount( ComponentName componentName, String id, Uri handle, - int labelResId, - int shortDescriptionResId, - int iconResId, + String label, + String shortDescription, boolean isEnabled, boolean isSystemDefault) { mComponentName = componentName; mId = id; mHandle = handle; - mLabelResId = labelResId; - mShortDescriptionResId = shortDescriptionResId; - mIconResId = iconResId; + mLabelResId = 0; // labelResId; + mShortDescriptionResId = 0; // shortDescriptionResId; + mIconResId = 0; // iconResId; mIsSystemDefault = isSystemDefault; mIsEnabled = isEnabled; } /** * The {@code ComponentName} of the {@link android.telecomm.ConnectionService} which is - * responsible for making phone calls using this {@code Subscription}. + * responsible for making phone calls using this {@code PhoneAccount}. * * @return A suitable {@code ComponentName}. */ @@ -78,20 +77,20 @@ public class Subscription implements Parcelable { } /** - * A unique identifier for this {@code Subscription}, generated by and meaningful to the + * A unique identifier for this {@code PhoneAccount}, generated by and meaningful to the * {@link android.telecomm.ConnectionService} that created it. * - * @return A unique identifier for this {@code Subscription}. + * @return A unique identifier for this {@code PhoneAccount}. */ public String getId() { return mId; } /** - * The handle (e.g., a phone number) associated with this {@code Subscription}. This represents - * the destination from which outgoing calls using this {@code Subscription} will appear to come + * The handle (e.g., a phone number) associated with this {@code PhoneAccount}. This represents + * the destination from which outgoing calls using this {@code PhoneAccount} will appear to come * from, if applicable, and the destination to which incoming calls using this - * {@code Subscription} may be addressed. + * {@code PhoneAccount} may be addressed. * * @return A handle expressed as a {@code Uri}, for example, a phone number. */ @@ -100,63 +99,63 @@ public class Subscription implements Parcelable { } /** - * A short string label describing this {@code Subscription}. + * A short string label describing this {@code PhoneAccount}. * * @param context The invoking {@code Context}, used for retrieving resources. * - * @return A label for this {@code Subscription}. + * @return A label for this {@code PhoneAccount}. */ public String getLabel(Context context) { return getString(context, mLabelResId); } /** - * A short paragraph describing this {@code Subscription}. + * A short paragraph describing this {@code PhoneAccount}. * * @param context The invoking {@code Context}, used for retrieving resources. * - * @return A description for this {@code Subscription}. + * @return A description for this {@code PhoneAccount}. */ public String getShortDescription(Context context) { return getString(context, mShortDescriptionResId); } /** - * An icon to represent this {@code Subscription} in a user interface. + * An icon to represent this {@code PhoneAccount} in a user interface. * * @param context The invoking {@code Context}, used for retrieving resources. * - * @return An icon for this {@code Subscription}. + * @return An icon for this {@code PhoneAccount}. */ public Drawable getIcon(Context context) { return getIcon(context, mIconResId, NO_DENSITY); } /** - * An icon to represent this {@code Subscription} in a user interface. + * An icon to represent this {@code PhoneAccount} in a user interface. * * @param context The invoking {@code Context}, used for retrieving resources. * @param density A display density from {@link DisplayMetrics}. * - * @return An icon for this {@code Subscription}. + * @return An icon for this {@code PhoneAccount}. */ public Drawable getIcon(Context context, int density) { return getIcon(context, mIconResId, density); } /** - * Whether this {@code Subscription} is enabled for use. + * Whether this {@code PhoneAccount} is enabled for use. * - * @return {@code true} if this {@code Subscription} is enabled. + * @return {@code true} if this {@code PhoneAccount} is enabled. */ public boolean isEnabled() { return mIsEnabled; } /** - * Whether this {@code Subscription} is the system default. + * Whether this {@code PhoneAccount} is the system default. * - * @return {@code true} if this {@code Subscription} is the system default. + * @return {@code true} if this {@code PhoneAccount} is the system default. */ public boolean isSystemDefault() { return mIsSystemDefault; @@ -177,18 +176,18 @@ public class Subscription implements Parcelable { out.writeInt(mIsSystemDefault ? 1 : 0); } - public static final Creator<Subscription> CREATOR - = new Creator<Subscription>() { - public Subscription createFromParcel(Parcel in) { - return new Subscription(in); + public static final Creator<PhoneAccount> CREATOR + = new Creator<PhoneAccount>() { + public PhoneAccount createFromParcel(Parcel in) { + return new PhoneAccount(in); } - public Subscription[] newArray(int size) { - return new Subscription[size]; + public PhoneAccount[] newArray(int size) { + return new PhoneAccount[size]; } }; - private Subscription(Parcel in) { + private PhoneAccount(Parcel in) { mComponentName = in.readParcelable(getClass().getClassLoader()); mId = in.readString(); String uriString = in.readString(); diff --git a/telecomm/java/android/telecomm/RemoteConnectionManager.java b/telecomm/java/android/telecomm/RemoteConnectionManager.java index ecfab5b..eb3154b 100644 --- a/telecomm/java/android/telecomm/RemoteConnectionManager.java +++ b/telecomm/java/android/telecomm/RemoteConnectionManager.java @@ -18,7 +18,6 @@ package android.telecomm; import android.content.ComponentName; import android.net.Uri; -import android.os.IBinder; import android.os.RemoteException; import com.android.internal.telecomm.ICallService; @@ -45,27 +44,27 @@ public class RemoteConnectionManager { } } - List<Subscription> getSubscriptions(Uri handle) { - List<Subscription> subscriptions = new LinkedList<>(); - Log.d(this, "Getting subscriptions: " + mRemoteConnectionServices.keySet()); + List<PhoneAccount> getAccounts(Uri handle) { + List<PhoneAccount> accounts = new LinkedList<>(); + Log.d(this, "Getting accounts: " + mRemoteConnectionServices.keySet()); for (RemoteConnectionService remoteService : mRemoteConnectionServices.values()) { // TODO(santoscordon): Eventually this will be async. - subscriptions.addAll(remoteService.lookupSubscriptions(handle)); + accounts.addAll(remoteService.lookupAccounts(handle)); } - return subscriptions; + return accounts; } public void createOutgoingConnection( ConnectionRequest request, - final ConnectionService.OutgoingCallResponse<RemoteConnection> response) { - Subscription subscription = request.getSubscription(); - if (subscription == null) { - throw new IllegalArgumentException("subscription must be specified."); + final ConnectionService.OutgoingCallResponse response) { + PhoneAccount account = request.getAccount(); + if (account == null) { + throw new IllegalArgumentException("account must be specified."); } - ComponentName componentName = request.getSubscription().getComponentName(); + ComponentName componentName = request.getAccount().getComponentName(); if (!mRemoteConnectionServices.containsKey(componentName)) { - throw new UnsupportedOperationException("subscription not supported: " + componentName); + throw new UnsupportedOperationException("account not supported: " + componentName); } else { RemoteConnectionService remoteService = mRemoteConnectionServices.get(componentName); remoteService.createOutgoingConnection(request, response); diff --git a/telecomm/java/android/telecomm/RemoteConnectionService.java b/telecomm/java/android/telecomm/RemoteConnectionService.java index f6fc69f..b3ef927 100644 --- a/telecomm/java/android/telecomm/RemoteConnectionService.java +++ b/telecomm/java/android/telecomm/RemoteConnectionService.java @@ -29,8 +29,6 @@ import com.android.internal.telecomm.ICallServiceAdapter; import com.android.internal.telecomm.ICallVideoProvider; import com.android.internal.telecomm.RemoteServiceCallback; -import java.util.ArrayList; -import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.UUID; @@ -252,20 +250,19 @@ public final class RemoteConnectionService implements DeathRecipient { // TODO(santoscordon): Handle incoming connections // public final void handleIncomingConnection() {} - public final List<Subscription> lookupSubscriptions(Uri handle) { + public final List<PhoneAccount> lookupAccounts(Uri handle) { // TODO(santoscordon): Update this so that is actually calls into the RemoteConnection // each time. - List<Subscription> subscriptions = new LinkedList<>(); - subscriptions.add(new Subscription( + List<PhoneAccount> accounts = new LinkedList<>(); + accounts.add(new PhoneAccount( mComponentName, null /* id */, null /* handle */, - 0 /* labelResId */, - 0 /* shortDescriptionResId */, - 0 /* iconResId */, + "" /* label */, + "" /* shortDescription */, true /* isEnabled */, false /* isSystemDefault */)); - return subscriptions; + return accounts; } /** diff --git a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl index 65389df..79a17e9 100644 --- a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl +++ b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl @@ -17,7 +17,7 @@ package com.android.internal.telecomm; import android.content.ComponentName; -import android.telecomm.Subscription; +import android.telecomm.PhoneAccount; /** * Interface used to interact with Telecomm. Mostly this is used by TelephonyManager for passing @@ -33,19 +33,19 @@ interface ITelecommService { void showCallScreen(boolean showDialpad); /** - * Gets a list of Subscriptions. + * Gets a list of accounts. */ - List<Subscription> getSubscriptions(); + List<PhoneAccount> getAccounts(); /** - * Sets the enabled state of a given Subscription. + * Sets the enabled state of a given account. */ - void setEnabled(in Subscription subscription, boolean enabled); + void setEnabled(in PhoneAccount account, boolean enabled); /** - * Sets a given Subscription as the system default. + * Sets a given account as the system default. */ - void setSystemDefault(in Subscription subscription); + void setSystemDefault(in PhoneAccount account); /** * Returns the component name of the default phone application. |