Remove ability to enable/disable phoneaccounts (1/6)

Enabling/disabling of phone accounts was only used for SIP accounts and
is no longer necessary for the purpose it was put in.
- Remove all references to enabling/disabling phone accounts
+ Rename getEnabledPhoneAccounts -> getCallCapablePhoneAccounts

Bug: 17510811

Change-Id: Id805daae3cc698c75f5e747b6a6107ab0bd3afa0
This commit is contained in:
Nancy Chen
2014-09-15 17:58:42 -07:00
parent a2f945e227
commit 210ef039fb
4 changed files with 26 additions and 111 deletions

View File

@@ -28195,7 +28195,6 @@ package android.telecom {
method public android.net.Uri getSubscriptionAddress();
method public java.util.List<java.lang.String> getSupportedUriSchemes();
method public boolean hasCapabilities(int);
method public boolean isEnabled();
method public boolean supportsUriScheme(java.lang.String);
method public void writeToParcel(android.os.Parcel, int);
field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1
@@ -28329,21 +28328,19 @@ package android.telecom {
method public void addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle);
method public void cancelMissedCallsNotification();
method public void clearAccounts();
method public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccounts();
method public android.telecom.PhoneAccountHandle getConnectionManager();
method public android.telecom.PhoneAccountHandle getDefaultOutgoingPhoneAccount(java.lang.String);
method public java.util.List<android.telecom.PhoneAccountHandle> getEnabledPhoneAccounts();
method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle);
method public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsSupportingScheme(java.lang.String);
method public boolean handleMmi(java.lang.String);
method public boolean hasMultipleEnabledAccounts();
method public boolean hasMultipleCallCapableAccounts();
method public boolean isInCall();
method public void registerPhoneAccount(android.telecom.PhoneAccount);
method public void showInCallScreen(boolean);
method public void unregisterPhoneAccount(android.telecom.PhoneAccountHandle);
field public static final java.lang.String ACTION_CHANGE_PHONE_ACCOUNTS = "android.telecom.action.CHANGE_PHONE_ACCOUNTS";
field public static final java.lang.String ACTION_CONNECTION_SERVICE_CONFIGURE = "android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
field public static final java.lang.String ACTION_PHONE_ACCOUNT_DISABLED = "android.telecom.action.PHONE_ACCOUNT_DISABLED";
field public static final java.lang.String ACTION_PHONE_ACCOUNT_ENABLED = "android.telecom.action.PHONE_ACCOUNT_ENABLED";
field public static final java.lang.String ACTION_SHOW_CALL_SETTINGS = "android.telecom.action.SHOW_CALL_SETTINGS";
field public static final char DTMF_CHARACTER_PAUSE = 44; // 0x002c ','
field public static final char DTMF_CHARACTER_WAIT = 59; // 0x003b ';'

View File

@@ -90,17 +90,6 @@ public class PhoneAccount implements Parcelable {
*/
public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 0x10;
/**
* Flag indicating that this {@code PhoneAccount} is always enabled and cannot be disabled by
* the user.
* This capability is reserved for important {@code PhoneAccount}s such as the emergency calling
* only {@code PhoneAccount}.
* <p>
* See {@link #getCapabilities}
* @hide
*/
public static final int CAPABILITY_ALWAYS_ENABLED = 0x20;
/**
* URI scheme for telephone number URIs.
*/
@@ -124,7 +113,6 @@ public class PhoneAccount implements Parcelable {
private final CharSequence mLabel;
private final CharSequence mShortDescription;
private final List<String> mSupportedUriSchemes;
private final boolean mIsEnabled;
public static class Builder {
private PhoneAccountHandle mAccountHandle;
@@ -135,7 +123,6 @@ public class PhoneAccount implements Parcelable {
private CharSequence mLabel;
private CharSequence mShortDescription;
private List<String> mSupportedUriSchemes = new ArrayList<String>();
private boolean mIsEnabled = false;
public Builder(PhoneAccountHandle accountHandle, CharSequence label) {
this.mAccountHandle = accountHandle;
@@ -157,7 +144,6 @@ public class PhoneAccount implements Parcelable {
mLabel = phoneAccount.getLabel();
mShortDescription = phoneAccount.getShortDescription();
mSupportedUriSchemes.addAll(phoneAccount.getSupportedUriSchemes());
mIsEnabled = phoneAccount.isEnabled();
}
public Builder setAddress(Uri value) {
@@ -216,19 +202,6 @@ public class PhoneAccount implements Parcelable {
return this;
}
/**
* Specifies whether the {@link PhoneAccount} is enabled or not. {@link PhoneAccount}s are
* by default not enabled.
*
* @param value {@code True} if the {@link PhoneAccount} is enabled.
* @return The Builder.
* @hide
*/
public Builder setEnabled(boolean value) {
this.mIsEnabled = value;
return this;
}
/**
* Creates an instance of a {@link PhoneAccount} based on the current builder settings.
*
@@ -248,8 +221,7 @@ public class PhoneAccount implements Parcelable {
mIconResId,
mLabel,
mShortDescription,
mSupportedUriSchemes,
mIsEnabled);
mSupportedUriSchemes);
}
}
@@ -261,8 +233,7 @@ public class PhoneAccount implements Parcelable {
int iconResId,
CharSequence label,
CharSequence shortDescription,
List<String> supportedUriSchemes,
boolean enabled) {
List<String> supportedUriSchemes) {
mAccountHandle = account;
mAddress = address;
mSubscriptionAddress = subscriptionAddress;
@@ -271,7 +242,6 @@ public class PhoneAccount implements Parcelable {
mLabel = label;
mShortDescription = shortDescription;
mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes);
mIsEnabled = enabled;
}
public static Builder builder(
@@ -391,15 +361,6 @@ public class PhoneAccount implements Parcelable {
return false;
}
/**
* Determines whether this {@code PhoneAccount} is enabled.
*
* @return {@code True} if this {@code PhoneAccount} is enabled..
*/
public boolean isEnabled() {
return mIsEnabled;
}
/**
* The icon resource ID for the icon of this {@code PhoneAccount}.
*
@@ -455,7 +416,6 @@ public class PhoneAccount implements Parcelable {
out.writeCharSequence(mLabel);
out.writeCharSequence(mShortDescription);
out.writeList(mSupportedUriSchemes);
out.writeInt(mIsEnabled ? 1 : 0);
}
public static final Creator<PhoneAccount> CREATOR
@@ -485,6 +445,5 @@ public class PhoneAccount implements Parcelable {
List<String> supportedUriSchemes = new ArrayList<>();
in.readList(supportedUriSchemes, classLoader);
mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes);
mIsEnabled = in.readInt() == 1;
}
}

View File

@@ -70,24 +70,6 @@ public class TelecomManager {
public static final String ACTION_CHANGE_PHONE_ACCOUNTS =
"android.telecom.action.CHANGE_PHONE_ACCOUNTS";
/**
* The {@link android.content.Intent} action used to inform a
* {@link android.telecom.ConnectionService} that one of its {@link PhoneAccount}s has been
* enabled. The {@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE} extra is used to indicate
* which {@link PhoneAccount} has been enabled.
*/
public static final String ACTION_PHONE_ACCOUNT_ENABLED =
"android.telecom.action.PHONE_ACCOUNT_ENABLED";
/**
* The {@link android.content.Intent} action used to inform a
* {@link android.telecom.ConnectionService} that one of its {@link PhoneAccount}s has been
* disabled. The {@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE} extra is used to indicate
* which {@link PhoneAccount} has been disabled.
*/
public static final String ACTION_PHONE_ACCOUNT_DISABLED =
"android.telecom.action.PHONE_ACCOUNT_DISABLED";
/**
* Optional extra for {@link android.content.Intent#ACTION_CALL} containing a boolean that
* determines whether the speakerphone should be automatically turned on for an outgoing call.
@@ -325,14 +307,14 @@ public class TelecomManager {
/**
* Return the {@link PhoneAccount} which is the user-chosen default for making outgoing phone
* calls with a specified URI scheme. This {@code PhoneAccount} will always be a member of the
* list which is returned from calling {@link #getEnabledPhoneAccounts()}.
* list which is returned from calling {@link #getCallCapablePhoneAccounts()}.
* <p>
* Apps must be prepared for this method to return {@code null}, indicating that there currently
* exists no user-chosen default {@code PhoneAccount}. In this case, apps wishing to initiate a
* phone call must either create their {@link android.content.Intent#ACTION_CALL} or
* {@link android.content.Intent#ACTION_DIAL} {@code Intent} with no
* {@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE}, or present the user with an affordance to
* select one of the elements of {@link #getEnabledPhoneAccounts()}.
* select one of the elements of {@link #getCallCapablePhoneAccounts()}.
* <p>
* An {@link android.content.Intent#ACTION_CALL} or {@link android.content.Intent#ACTION_DIAL}
* {@code Intent} with no {@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE} is valid, and
@@ -355,7 +337,7 @@ public class TelecomManager {
/**
* Return the {@link PhoneAccount} which is the user-chosen default for making outgoing phone
* calls. This {@code PhoneAccount} will always be a member of the list which is returned from
* calling {@link #getEnabledPhoneAccounts()}
* calling {@link #getCallCapablePhoneAccounts()}
*
* Apps must be prepared for this method to return {@code null}, indicating that there currently
* exists no user-chosen default {@code PhoneAccount}.
@@ -389,19 +371,19 @@ public class TelecomManager {
}
/**
* Return a list of enabled {@link PhoneAccountHandle}s which can be used to make and receive
* phone calls.
* Return a list of {@link PhoneAccountHandle}s which can be used to make and receive phone
* calls.
*
* @see #EXTRA_PHONE_ACCOUNT_HANDLE
* @return A list of {@code PhoneAccountHandle} objects.
*/
public List<PhoneAccountHandle> getEnabledPhoneAccounts() {
public List<PhoneAccountHandle> getCallCapablePhoneAccounts() {
try {
if (isServiceConnected()) {
return getTelecomService().getEnabledPhoneAccounts();
return getTelecomService().getCallCapablePhoneAccounts();
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#getEnabledPhoneAccounts", e);
Log.e(TAG, "Error calling ITelecomService#getCallCapablePhoneAccounts", e);
}
return new ArrayList<>();
}
@@ -467,8 +449,8 @@ public class TelecomManager {
}
/**
* Returns a list of the enabled {@link PhoneAccountHandle}s which can be used to make and
* receive phone calls which support the specified URI scheme.
* Returns a list of the {@link PhoneAccountHandle}s which can be used to make and receive phone
* calls which support the specified URI scheme.
* <P>
* For example, invoking with {@code "tel"} will find all {@link PhoneAccountHandle}s which
* support telephone calls (e.g. URIs such as {@code tel:555-555-1212}). Invoking with
@@ -490,13 +472,14 @@ public class TelecomManager {
}
/**
* Determine whether the device has more than one account registered and enabled.
* Determine whether the device has more than one account registered that can make and receive
* phone calls.
*
* @return {@code true} if the device has more than one account registered and enabled and
* {@code false} otherwise.
* @return {@code true} if the device has more than one account registered and {@code false}
* otherwise.
*/
public boolean hasMultipleEnabledAccounts() {
return getEnabledPhoneAccounts().size() > 1;
public boolean hasMultipleCallCapableAccounts() {
return getCallCapablePhoneAccounts().size() > 1;
}
/**
@@ -518,9 +501,9 @@ public class TelecomManager {
}
/**
* Returns a count of enabled and disabled {@link PhoneAccount}s.
* Returns a count of all {@link PhoneAccount}s.
*
* @return The count of enabled and disabled {@link PhoneAccount}s.
* @return The count of {@link PhoneAccount}s.
* @hide
*/
@SystemApi
@@ -571,24 +554,6 @@ public class TelecomManager {
return Collections.EMPTY_LIST;
}
/**
* Enables or disables a {@link PhoneAccount}.
*
* @param account The {@link PhoneAccountHandle} to enable or disable.
* @param isEnabled {@code True} if the phone account should be enabled.
* @hide
*/
@SystemApi
public void setPhoneAccountEnabled(PhoneAccountHandle account, boolean isEnabled) {
try {
if (isServiceConnected()) {
getTelecomService().setPhoneAccountEnabled(account, isEnabled);
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#setPhoneAccountEnabled", e);
}
}
/**
* Register a {@link PhoneAccount} for use by the system.
*
@@ -801,9 +766,8 @@ public class TelecomManager {
/**
* Registers a new incoming call. A {@link ConnectionService} should invoke this method when it
* has an incoming call. The specified {@link PhoneAccountHandle} must have been registered
* with {@link #registerPhoneAccount} and subsequently enabled by the user within the phone's
* settings. Once invoked, this method will cause the system to bind to the
* {@link ConnectionService} associated with the {@link PhoneAccountHandle} and request
* with {@link #registerPhoneAccount}. Once invoked, this method will cause the system to bind
* to the {@link ConnectionService} associated with the {@link PhoneAccountHandle} and request
* additional information about the call (See
* {@link ConnectionService#onCreateIncomingConnection}) before starting the incoming call UI.
*

View File

@@ -50,9 +50,9 @@ interface ITelecomService {
void setUserSelectedOutgoingPhoneAccount(in PhoneAccountHandle account);
/**
* @see TelecomServiceImpl#getEnabledPhoneAccounts
* @see TelecomServiceImpl#getCallCapablePhoneAccounts
*/
List<PhoneAccountHandle> getEnabledPhoneAccounts();
List<PhoneAccountHandle> getCallCapablePhoneAccounts();
/**
* @see TelecomManager#getPhoneAccountsSupportingScheme
@@ -94,11 +94,6 @@ interface ITelecomService {
*/
List<PhoneAccountHandle> getSimCallManagers();
/**
* @see TelecomServiceImpl#setPhoneAccountEnabled
*/
void setPhoneAccountEnabled(in PhoneAccountHandle account, in boolean isEnabled);
/**
* @see TelecomServiceImpl#registerPhoneAccount
*/