diff options
author | Andrew Lee <anwlee@google.com> | 2014-08-28 16:50:10 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2014-08-29 11:04:08 -0700 |
commit | 59cac3a88178b0b25d1aeba49a42204a9add3892 (patch) | |
tree | 0f7e8bc497b8dc31b8135c961b96eaafa0267a78 /telecomm/java | |
parent | 6a6a8f00946f963191612f64238bd706c2188dd8 (diff) | |
download | frameworks_base-59cac3a88178b0b25d1aeba49a42204a9add3892.zip frameworks_base-59cac3a88178b0b25d1aeba49a42204a9add3892.tar.gz frameworks_base-59cac3a88178b0b25d1aeba49a42204a9add3892.tar.bz2 |
Add functions for setting/getting phone accounts.
Bug: 17179743
Change-Id: I821312ae5903f81a5282987189822e77ac55b7ef
Diffstat (limited to 'telecomm/java')
-rw-r--r-- | telecomm/java/android/telecomm/TelecommManager.java | 65 | ||||
-rw-r--r-- | telecomm/java/com/android/internal/telecomm/ITelecommService.aidl | 54 |
2 files changed, 101 insertions, 18 deletions
diff --git a/telecomm/java/android/telecomm/TelecommManager.java b/telecomm/java/android/telecomm/TelecommManager.java index 868282f..2243288 100644 --- a/telecomm/java/android/telecomm/TelecommManager.java +++ b/telecomm/java/android/telecomm/TelecommManager.java @@ -285,6 +285,20 @@ public class TelecommManager { } /** + * Sets the default account for making outgoing phone calls. + * @hide + */ + public void setDefaultOutgoingPhoneAccount(PhoneAccountHandle accountHandle) { + try { + if (isServiceConnected()) { + getTelecommService().setDefaultOutgoingPhoneAccount(accountHandle); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelecommService#setDefaultOutgoingPhoneAccount"); + } + } + + /** * Return a list of {@link PhoneAccountHandle}s which can be used to make and receive phone * calls. * @@ -303,6 +317,55 @@ public class TelecommManager { } /** + * 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}. + * @return The phone account handle of the current sim call manager. + * @hide + */ + public PhoneAccountHandle getSimCallManager() { + try { + if (isServiceConnected()) { + return getTelecommService().getSimCallManager(); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelecommService#getSimCallManager"); + } + return null; + } + + /** + * Sets the SIM call manager to the specified phone account. + * @param accountHandle The phone account handle of the account to set as the sim call manager. + * @hide + */ + public void setSimCallManager(PhoneAccountHandle accountHandle) { + try { + if (isServiceConnected()) { + getTelecommService().setSimCallManager(accountHandle); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelecommService#setSimCallManager"); + } + } + + /** + * Returns the list of registered SIM call managers. + * @return List of registered SIM call managers. + * @hide + */ + public List<PhoneAccountHandle> getSimCallManagers() { + try { + if (isServiceConnected()) { + return getTelecommService().getSimCallManagers(); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelecommService#getSimCallManagers"); + } + return new ArrayList<>(); + } + + /** * Determine whether the device has more than one account registered and enabled. * * @return {@code true} if the device has more than one account registered and enabled and @@ -614,4 +677,4 @@ public class TelecommManager { } return isConnected; } -} +}
\ No newline at end of file diff --git a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl index 0ac5078..131307a 100644 --- a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl +++ b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl @@ -35,37 +35,57 @@ interface ITelecommService { void showInCallScreen(boolean showDialpad); /** - * @see TelecommManager#getDefaultOutgoingPhoneAccount + * @see TelecommServiceImpl#getDefaultOutgoingPhoneAccount */ PhoneAccountHandle getDefaultOutgoingPhoneAccount(); /** - * @see TelecommManager#getOutgoingPhoneAccounts + * @see TelecommServiceImpl#setDefaultOutgoingPhoneAccount + */ + void setDefaultOutgoingPhoneAccount(in PhoneAccountHandle account); + + /** + * @see TelecommServiceImpl#getOutgoingPhoneAccounts */ List<PhoneAccountHandle> getOutgoingPhoneAccounts(); /** - * @see TelecommManager#getPhoneAccount + * @see TelecommServiceImpl#getPhoneAccount */ PhoneAccount getPhoneAccount(in PhoneAccountHandle account); /** - * @see TelecommManager#registerPhoneAccount + * @see TelecommServiceImpl#getSimCallManager + */ + PhoneAccountHandle getSimCallManager(); + + /** + * @see TelecommServiceImpl#setSimCallManager + */ + void setSimCallManager(in PhoneAccountHandle account); + + /** + * @see TelecommServiceImpl#getSimCallManagers + */ + List<PhoneAccountHandle> getSimCallManagers(); + + /** + * @see TelecommServiceImpl#registerPhoneAccount */ void registerPhoneAccount(in PhoneAccount metadata); /** - * @see TelecommManager#unregisterPhoneAccount + * @see TelecommServiceImpl#unregisterPhoneAccount */ void unregisterPhoneAccount(in PhoneAccountHandle account); /** - * @see TelecommManager#clearAccounts + * @see TelecommServiceImpl#clearAccounts */ void clearAccounts(String packageName); /** - * @see TelecommManager#getDefaultPhoneApp + * @see TelecommServiceImpl#getDefaultPhoneApp */ ComponentName getDefaultPhoneApp(); @@ -74,52 +94,52 @@ interface ITelecommService { // /** - * @see TelecommManager#silenceRinger + * @see TelecommServiceImpl#silenceRinger */ void silenceRinger(); /** - * @see TelecommManager#isInCall + * @see TelecommServiceImpl#isInCall */ boolean isInCall(); /** - * @see TelecomManager#isRinging + * @see TelecommServiceImpl#isRinging */ boolean isRinging(); /** - * @see TelecommManager#endCall + * @see TelecommServiceImpl#endCall */ boolean endCall(); /** - * @see TelecommManager#acceptRingingCall + * @see TelecommServiceImpl#acceptRingingCall */ void acceptRingingCall(); /** - * @see TelecommManager#cancelMissedCallsNotification + * @see TelecommServiceImpl#cancelMissedCallsNotification */ void cancelMissedCallsNotification(); /** - * @see TelecommManager#handleMmi + * @see TelecommServiceImpl#handleMmi */ boolean handlePinMmi(String dialString); /** - * @see TelecomManager#isTtySupported + * @see TelecommServiceImpl#isTtySupported */ boolean isTtySupported(); /** - * @see TelecomManager#getCurrentTtyMode + * @see TelecommServiceImpl#getCurrentTtyMode */ int getCurrentTtyMode(); /** - * @see TelecommManager#addNewIncomingCall + * @see TelecommServiceImpl#addNewIncomingCall */ void addNewIncomingCall(in PhoneAccountHandle phoneAccount, in Bundle extras); } |