diff options
Diffstat (limited to 'telecomm/java/android/telecom/TelecomManager.java')
| -rw-r--r-- | telecomm/java/android/telecom/TelecomManager.java | 67 |
1 files changed, 65 insertions, 2 deletions
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index bc51a70..d98a255 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -17,6 +17,7 @@ package android.telecom; import android.annotation.SystemApi; import android.content.ComponentName; import android.content.Context; +import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; @@ -31,7 +32,17 @@ import java.util.Collections; import java.util.List; /** - * Provides access to Telecom-related functionality. + * Provides access to information about active calls and registration/call-management functionality. + * Apps can use methods in this class to determine the current call state. Apps can also register new + * {@link PhoneAccount}s and get a listing of existing {@link PhoneAccount}s. + * <p> + * Apps do not instantiate this class directly; instead, they retrieve a reference to an instance + * through {@link Context#getSystemService Context.getSystemService(Context.TELECOM_SERVICE)}. + * <p> + * Note that access to some telecom information is permission-protected. Your app cannot access the + * protected information or gain access to protected functionality unless it has the appropriate + * permissions declared in its manifest file. Where permissions apply, they are noted in the method + * descriptions. */ public class TelecomManager { @@ -583,7 +594,16 @@ public class TelecomManager { } /** - * Register a {@link PhoneAccount} for use by the system. + * Register a {@link PhoneAccount} for use by the system. When registering + * {@link PhoneAccount}s, existing registrations will be overwritten if the + * {@link PhoneAccountHandle} matches that of a {@link PhoneAccount} which is already + * registered. Once registered, the {@link PhoneAccount} is listed to the user as an option + * when placing calls. The user may still need to enable the {@link PhoneAccount} within + * the phone app settings before the account is usable. + * <p> + * A {@link SecurityException} will be thrown if an app tries to register a + * {@link PhoneAccountHandle} where the package name specified within + * {@link PhoneAccountHandle#getComponentName()} does not match the package name of the app. * * @param account The complete {@link PhoneAccount}. */ @@ -876,6 +896,7 @@ public class TelecomManager { * Processes the specified dial string as an MMI code. * MMI codes are any sequence of characters entered into the dialpad that contain a "*" or "#". * Some of these sequences launch special behavior through handled by Telephony. + * This method uses the default subscription. * <p> * Requires that the method-caller be set as the system dialer app. * </p> @@ -896,6 +917,48 @@ public class TelecomManager { } /** + * Processes the specified dial string as an MMI code. + * MMI codes are any sequence of characters entered into the dialpad that contain a "*" or "#". + * Some of these sequences launch special behavior through handled by Telephony. + * <p> + * Requires that the method-caller be set as the system dialer app. + * </p> + * + * @param accountHandle The handle for the account the MMI code should apply to. + * @param dialString The digits to dial. + * @return True if the digits were processed as an MMI code, false otherwise. + */ + public boolean handleMmi(PhoneAccountHandle accountHandle, String dialString) { + ITelecomService service = getTelecomService(); + if (service != null) { + try { + return service.handlePinMmiForPhoneAccount(accountHandle, dialString); + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelecomService#handlePinMmi", e); + } + } + return false; + } + + /** + * @param accountHandle The handle for the account to derive an adn query URI for or + * {@code null} to return a URI which will use the default account. + * @return The URI (with the content:// scheme) specific to the specified {@link PhoneAccount} + * for the the content retrieve. + */ + public Uri getAdnUriForPhoneAccount(PhoneAccountHandle accountHandle) { + ITelecomService service = getTelecomService(); + if (service != null && accountHandle != null) { + try { + return service.getAdnUriForPhoneAccount(accountHandle); + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelecomService#getAdnUriForPhoneAccount", e); + } + } + return Uri.parse("content://icc/adn"); + } + + /** * Removes the missed-call notification if one is present. * <p> * Requires that the method-caller be set as the system dialer app. |
