am 5cfc3188: am 08c79caf: Merge "Add functions for setting/getting phone accounts." into lmp-dev

* commit '5cfc3188f93c88e291c81ef8b41061b2faa7503d':
  Add functions for setting/getting phone accounts.
This commit is contained in:
Andrew Lee
2014-08-29 23:54:27 +00:00
committed by Android Git Automerger
2 changed files with 101 additions and 18 deletions

View File

@@ -284,6 +284,20 @@ public class TelecommManager {
return null;
}
/**
* 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.
@@ -302,6 +316,55 @@ public class TelecommManager {
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}.
* @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.
*
@@ -614,4 +677,4 @@ public class TelecommManager {
}
return isConnected;
}
}
}

View File

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