Merge "Rename Telecomm "Subscription" to "Account" (1/7)"

This commit is contained in:
Ihab Awad
2014-07-02 19:55:51 +00:00
committed by Android (Google) Code Review
12 changed files with 165 additions and 169 deletions

View File

@@ -22894,6 +22894,8 @@ package android.provider {
public static class CallLog.Calls implements android.provider.BaseColumns {
ctor public CallLog.Calls();
method public static java.lang.String getLastOutgoingCall(android.content.Context);
field public static final java.lang.String ACCOUNT_COMPONENT_NAME = "subscription_component_name";
field public static final java.lang.String ACCOUNT_ID = "subscription_id";
field public static final java.lang.String CACHED_FORMATTED_NUMBER = "formatted_number";
field public static final java.lang.String CACHED_LOOKUP_URI = "lookup_uri";
field public static final java.lang.String CACHED_MATCHED_NUMBER = "matched_number";
@@ -22925,8 +22927,6 @@ package android.provider {
field public static final int PRESENTATION_PAYPHONE = 4; // 0x4
field public static final int PRESENTATION_RESTRICTED = 2; // 0x2
field public static final int PRESENTATION_UNKNOWN = 3; // 0x3
field public static final java.lang.String SUBSCRIPTION_COMPONENT_NAME = "subscription_component_name";
field public static final java.lang.String SUBSCRIPTION_ID = "subscription_id";
field public static final java.lang.String TYPE = "type";
field public static final int VOICEMAIL_TYPE = 4; // 0x4
field public static final java.lang.String VOICEMAIL_URI = "voicemail_uri";
@@ -27480,6 +27480,7 @@ package android.telecomm {
public final class CallInfo implements android.os.Parcelable {
ctor public CallInfo(java.lang.String, android.telecomm.CallState, android.net.Uri);
method public int describeContents();
method public android.telecomm.PhoneAccount getAccount();
method public android.telecomm.CallServiceDescriptor getCurrentCallServiceDescriptor();
method public android.os.Bundle getExtras();
method public android.telecomm.GatewayInfo getGatewayInfo();
@@ -27487,7 +27488,6 @@ package android.telecomm {
method public java.lang.String getId();
method public android.net.Uri getOriginalHandle();
method public android.telecomm.CallState getState();
method public android.telecomm.Subscription getSubscription();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
@@ -27670,12 +27670,12 @@ package android.telecomm {
public final class ConnectionRequest implements android.os.Parcelable {
ctor public ConnectionRequest(android.net.Uri, android.os.Bundle);
ctor public ConnectionRequest(java.lang.String, android.net.Uri, android.os.Bundle);
ctor public ConnectionRequest(android.telecomm.Subscription, java.lang.String, android.net.Uri, android.os.Bundle);
ctor public ConnectionRequest(android.telecomm.PhoneAccount, java.lang.String, android.net.Uri, android.os.Bundle);
method public int describeContents();
method public android.telecomm.PhoneAccount getAccount();
method public java.lang.String getCallId();
method public android.os.Bundle getExtras();
method public android.net.Uri getHandle();
method public android.telecomm.Subscription getSubscription();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
@@ -27689,8 +27689,8 @@ package android.telecomm {
method public final void disconnect(java.lang.String);
method public final java.util.Collection<android.telecomm.Connection> getAllConnections();
method public final void hold(java.lang.String);
method public final void lookupRemoteSubscriptions(android.net.Uri, android.telecomm.SimpleResponse<android.net.Uri, java.util.List<android.telecomm.Subscription>>);
method public final void maybeRespondToSubscriptionLookup();
method public final void lookupRemoteAccounts(android.net.Uri, android.telecomm.SimpleResponse<android.net.Uri, java.util.List<android.telecomm.PhoneAccount>>);
method public final void maybeRespondToAccountLookup();
method public final void onAudioStateChanged(java.lang.String, android.telecomm.CallAudioState);
method protected void onConnectionAdded(android.telecomm.Connection);
method protected void onConnectionRemoved(android.telecomm.Connection);
@@ -27737,6 +27737,7 @@ package android.telecomm {
public final class InCallCall implements android.os.Parcelable {
method public int describeContents();
method public android.telecomm.PhoneAccount getAccount();
method public android.telecomm.RemoteCallVideoProvider getCallVideoProvider() throws android.os.RemoteException;
method public java.util.List<java.lang.String> getCannedSmsResponses();
method public int getCapabilities();
@@ -27750,7 +27751,6 @@ package android.telecomm {
method public android.telecomm.CallServiceDescriptor getHandoffCallServiceDescriptor();
method public java.lang.String getId();
method public android.telecomm.CallState getState();
method public android.telecomm.Subscription getSubscription();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
@@ -27768,6 +27768,22 @@ package android.telecomm {
method protected abstract void updateCall(android.telecomm.InCallCall);
}
public class PhoneAccount implements android.os.Parcelable {
ctor public PhoneAccount(android.content.ComponentName, java.lang.String, android.net.Uri, java.lang.String, java.lang.String, boolean, boolean);
method public int describeContents();
method public android.content.ComponentName getComponentName();
method public android.net.Uri getHandle();
method public android.graphics.drawable.Drawable getIcon(android.content.Context);
method public android.graphics.drawable.Drawable getIcon(android.content.Context, int);
method public java.lang.String getId();
method public java.lang.String getLabel(android.content.Context);
method public java.lang.String getShortDescription(android.content.Context);
method public boolean isEnabled();
method public boolean isSystemDefault();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public class RemoteCallVideoClient implements android.os.IBinder.DeathRecipient {
method public void binderDied();
method public void handleCallSessionEvent(int) throws android.os.RemoteException;
@@ -27829,22 +27845,6 @@ package android.telecomm {
method public abstract void onResult(IN, OUT);
}
public class Subscription implements android.os.Parcelable {
ctor public Subscription(android.content.ComponentName, java.lang.String, android.net.Uri, int, int, int, boolean, boolean);
method public int describeContents();
method public android.content.ComponentName getComponentName();
method public android.net.Uri getHandle();
method public android.graphics.drawable.Drawable getIcon(android.content.Context);
method public android.graphics.drawable.Drawable getIcon(android.content.Context, int);
method public java.lang.String getId();
method public java.lang.String getLabel(android.content.Context);
method public java.lang.String getShortDescription(android.content.Context);
method public boolean isEnabled();
method public boolean isSystemDefault();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class TelecommConstants {
ctor public TelecommConstants();
field public static final java.lang.String ACTION_CALL_SERVICE;
@@ -28293,6 +28293,7 @@ package android.telephony {
}
public class TelephonyManager {
method public java.util.List<android.telecomm.PhoneAccount> getAccounts();
method public java.util.List<android.telephony.CellInfo> getAllCellInfo();
method public int getCallState();
method public android.telephony.CellLocation getCellLocation();
@@ -28316,7 +28317,6 @@ package android.telephony {
method public java.lang.String getSimSerialNumber();
method public int getSimState();
method public java.lang.String getSubscriberId();
method public java.util.List<android.telecomm.Subscription> getSubscriptions();
method public java.lang.String getVoiceMailAlphaTag();
method public java.lang.String getVoiceMailNumber();
method public boolean hasIccCard();
@@ -28336,12 +28336,12 @@ package android.telephony {
field public static final int DATA_CONNECTING = 1; // 0x1
field public static final int DATA_DISCONNECTED = 0; // 0x0
field public static final int DATA_SUSPENDED = 3; // 0x3
field public static final java.lang.String EXTRA_ACCOUNT = "account";
field public static final java.lang.String EXTRA_INCOMING_NUMBER = "incoming_number";
field public static final java.lang.String EXTRA_STATE = "state";
field public static final java.lang.String EXTRA_STATE_IDLE;
field public static final java.lang.String EXTRA_STATE_OFFHOOK;
field public static final java.lang.String EXTRA_STATE_RINGING;
field public static final java.lang.String EXTRA_SUBSCRIPTION = "subscription";
field public static final int NETWORK_TYPE_1xRTT = 7; // 0x7
field public static final int NETWORK_TYPE_CDMA = 4; // 0x4
field public static final int NETWORK_TYPE_EDGE = 2; // 0x2

View File

@@ -25,7 +25,7 @@ import android.net.Uri;
import android.provider.ContactsContract.CommonDataKinds.Callable;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.DataUsageFeedback;
import android.telecomm.Subscription;
import android.telecomm.PhoneAccount;
import android.text.TextUtils;
import com.android.internal.telephony.CallerInfo;
@@ -276,17 +276,20 @@ public class CallLog {
*/
public static final String CACHED_FORMATTED_NUMBER = "formatted_number";
/**
* The component name of the subscription in string form.
* <P>Type: TEXT</P>
*/
public static final String SUBSCRIPTION_COMPONENT_NAME = "subscription_component_name";
// Note: PHONE_ACCOUNT_* constant values are "subscription_*" due to a historic naming
// that was encoded into call log databases.
/**
* The identifier of a subscription that is unique to a specified component.
* The component name of the account in string form.
* <P>Type: TEXT</P>
*/
public static final String SUBSCRIPTION_ID = "subscription_id";
public static final String PHONE_ACCOUNT_COMPONENT_NAME = "subscription_component_name";
/**
* The identifier of a account that is unique to a specified component.
* <P>Type: TEXT</P>
*/
public static final String PHONE_ACCOUNT_ID = "subscription_id";
/**
* Adds a call to the call log.
@@ -299,14 +302,14 @@ public class CallLog {
* is set by the network and denotes the number presenting rules for
* "allowed", "payphone", "restricted" or "unknown"
* @param callType enumerated values for "incoming", "outgoing", or "missed"
* @param subscription The subscription object describing the provider of the call
* @param account The account object describing the provider of the call
* @param start time stamp for the call in milliseconds
* @param duration call duration in seconds
*
* {@hide}
*/
public static Uri addCall(CallerInfo ci, Context context, String number,
int presentation, int callType, Subscription subscription, long start, int duration) {
int presentation, int callType, PhoneAccount account, long start, int duration) {
final ContentResolver resolver = context.getContentResolver();
int numberPresentation = PRESENTATION_ALLOWED;
@@ -330,12 +333,12 @@ public class CallLog {
}
}
// subscription information
String subscriptionComponentString = null;
String subscriptionId = null;
if (subscription != null) {
subscriptionComponentString = subscription.getComponentName().flattenToString();
subscriptionId = subscription.getId();
// account information
String accountComponentString = null;
String accountId = null;
if (account != null) {
accountComponentString = account.getComponentName().flattenToString();
accountId = account.getId();
}
ContentValues values = new ContentValues(6);
@@ -345,8 +348,8 @@ public class CallLog {
values.put(TYPE, Integer.valueOf(callType));
values.put(DATE, Long.valueOf(start));
values.put(DURATION, Long.valueOf(duration));
values.put(SUBSCRIPTION_COMPONENT_NAME, subscriptionComponentString);
values.put(SUBSCRIPTION_ID, subscriptionId);
values.put(PHONE_ACCOUNT_COMPONENT_NAME, accountComponentString);
values.put(PHONE_ACCOUNT_ID, accountId);
values.put(NEW, Integer.valueOf(1));
if (callType == MISSED_TYPE) {
values.put(IS_READ, Integer.valueOf(0));

View File

@@ -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,

View File

@@ -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.

View File

@@ -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;
}
}

View File

@@ -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(

View File

@@ -19,4 +19,4 @@ package android.telecomm;
/**
* {@hide}
*/
parcelable Subscription;
parcelable PhoneAccount;

View File

@@ -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();

View File

@@ -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);

View File

@@ -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;
}
/**

View File

@@ -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.

View File

@@ -24,7 +24,7 @@ import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.telecomm.Subscription;
import android.telecomm.PhoneAccount;
import android.util.Log;
import com.android.internal.telecomm.ITelecommService;
@@ -299,14 +299,14 @@ public class TelephonyManager {
/**
* The lookup key used with an {@link android.content.Intent#ACTION_CALL} or
* {@link android.content.Intent#ACTION_DIAL} {@code Intent} for a {@link Subscription}
* {@link android.content.Intent#ACTION_DIAL} {@code Intent} for a {@link PhoneAccount}
* object indicating a preference when making a phone connection.
*
* <p class="note">
* Retrieve with
* {@link android.content.Intent#getParcelableExtra(String)}.
*/
public static final String EXTRA_SUBSCRIPTION = "subscription";
public static final String EXTRA_ACCOUNT = "account";
/**
* Broadcast intent action indicating that a precise call state
@@ -3118,26 +3118,26 @@ public class TelephonyManager {
}
/**
* Return a list of Subscriptions that can be used to indicate a preference when making
* Return a list of Accounts that can be used to indicate a preference when making
* a phone call.
*
* @see #EXTRA_SUBSCRIPTION
* @return A list of {@code Subscription} objects.
* @see #EXTRA_ACCOUNT
* @return A list of {@code Accouint} objects.
*/
public List<Subscription> getSubscriptions() {
public List<PhoneAccount> getAccounts() {
try {
return getTelecommService().getSubscriptions();
return getTelecommService().getAccounts();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#getSubscriptions", e);
Log.e(TAG, "Error calling ITelephony#getAccounts", e);
}
return null;
}
/** @hide */
@SystemApi
public void setEnabled(Subscription subscription, boolean enabled) {
public void setEnabled(PhoneAccount account, boolean enabled) {
try {
getTelecommService().setEnabled(subscription, enabled);
getTelecommService().setEnabled(account, enabled);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#setEnabled", e);
}
@@ -3145,9 +3145,9 @@ public class TelephonyManager {
/** @hide */
@SystemApi
public void setSystemDefault(Subscription subscription) {
public void setSystemDefault(PhoneAccount account) {
try {
getTelecommService().setSystemDefault(subscription);
getTelecommService().setSystemDefault(account);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#setSystemDefault", e);
}