summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2014-09-17 14:47:20 -0700
committerNancy Chen <nancychen@google.com>2014-09-17 18:34:13 -0700
commit513c8921359c2b576e0713da6d649e5e7c29d179 (patch)
treeee3d0bed8a1285a5c1720811694607cded8e8088 /telecomm
parent77ebdcbaaad6da33c7bdb5a2b22df45959f7f6d9 (diff)
downloadframeworks_base-513c8921359c2b576e0713da6d649e5e7c29d179.zip
frameworks_base-513c8921359c2b576e0713da6d649e5e7c29d179.tar.gz
frameworks_base-513c8921359c2b576e0713da6d649e5e7c29d179.tar.bz2
Replace get*PhoneAccounts* public API methods with new method (1/3)
Hide getCallCapablePhoneAccounts and getPhoneAccountsSupportingScheme because a third party app should not be able to see all phone accounts registered. Replace instead with getPhoneAccountsForPackage(Context) which will only return the phone accounts registered by a particular package. Bug: 17510811 Change-Id: I8465ef4f13b62fe83f51835cfffe1656298041a8
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecom/Call.java9
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java75
-rw-r--r--telecomm/java/com/android/internal/telecom/ITelecomService.aidl5
3 files changed, 59 insertions, 30 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 1a6c52f..b0b6fb9 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -80,6 +80,15 @@ public final class Call {
*/
public static final int STATE_CONNECTING = 9;
+ /**
+ * The key to retrieve the optional {@code PhoneAccount}s Telecom can bundle with its Call
+ * extras. Used to pass the phone accounts to display on the front end to the user in order to
+ * select phone accounts to (for example) place a call.
+ *
+ * @hide
+ */
+ public static final String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts";
+
public static class Details {
private final Uri mHandle;
private final int mHandlePresentation;
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index a91d92f..481e483 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -306,22 +306,16 @@ 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 #getCallCapablePhoneAccounts()}.
+ * calls with a specified URI scheme.
* <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 #getCallCapablePhoneAccounts()}.
+ * exists no user-chosen default {@code PhoneAccount}.
* <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
- * subsequent steps in the phone call flow are responsible for presenting the user with an
- * affordance, if necessary, to choose a {@code PhoneAccount}.
- *
* @param uriScheme The URI scheme.
+ * @return The {@link PhoneAccountHandle} corresponding to the user-chosen default for outgoing
+ * phone calls for a specified URI scheme.
+ *
+ * @hide
*/
public PhoneAccountHandle getDefaultOutgoingPhoneAccount(String uriScheme) {
try {
@@ -371,24 +365,6 @@ public class TelecomManager {
}
/**
- * 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> getCallCapablePhoneAccounts() {
- try {
- if (isServiceConnected()) {
- return getTelecomService().getCallCapablePhoneAccounts();
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelecomService#getCallCapablePhoneAccounts", e);
- }
- return new ArrayList<>();
- }
-
- /**
* Returns the current SIM call manager. Apps must be prepared for this method to return
* {@code null}, indicating that there currently exists no user-chosen default
* {@code PhoneAccount}.
@@ -459,6 +435,8 @@ public class TelecomManager {
*
* @param uriScheme The URI scheme.
* @return A list of {@code PhoneAccountHandle} objects supporting the URI scheme.
+ *
+ * @hide
*/
public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme) {
try {
@@ -471,6 +449,27 @@ public class TelecomManager {
return new ArrayList<>();
}
+
+ /**
+ * 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.
+ *
+ * @hide
+ */
+ public List<PhoneAccountHandle> getCallCapablePhoneAccounts() {
+ try {
+ if (isServiceConnected()) {
+ return getTelecomService().getCallCapablePhoneAccounts();
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelecomService#getCallCapablePhoneAccounts", e);
+ }
+ return new ArrayList<>();
+ }
+
/**
* Determine whether the device has more than one account registered that can make and receive
* phone calls.
@@ -483,6 +482,22 @@ public class TelecomManager {
}
/**
+ * Returns a list of all {@link PhoneAccount}s registered for the calling package.
+ *
+ * @return A list of {@code PhoneAccountHandle} objects.
+ */
+ public List<PhoneAccountHandle> getPhoneAccountsForPackage() {
+ try {
+ if (isServiceConnected()) {
+ return getTelecomService().getPhoneAccountsForPackage(mContext.getPackageName());
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelecomService#getPhoneAccountsForPackage", e);
+ }
+ return null;
+ }
+
+ /**
* Return the {@link PhoneAccount} for a specified {@link PhoneAccountHandle}. Object includes
* resources which can be used in a user interface.
*
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 77a80fe..feb09d5 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -60,6 +60,11 @@ interface ITelecomService {
List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(in String uriScheme);
/**
+ * @see TelecomManager#getPhoneAccountsForPackage
+ */
+ List<PhoneAccountHandle> getPhoneAccountsForPackage(in String packageName);
+
+ /**
* @see TelecomManager#getPhoneAccount
*/
PhoneAccount getPhoneAccount(in PhoneAccountHandle account);