Merge "add an API for sending secret dialer code"

This commit is contained in:
Chen Xu
2017-01-28 17:00:54 +00:00
committed by Android (Google) Code Review
5 changed files with 30 additions and 0 deletions

View File

@@ -38858,6 +38858,7 @@ package android.telephony {
method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle);
method public boolean isWorldPhone();
method public void listen(android.telephony.PhoneStateListener, int);
method public boolean sendDialerCode(java.lang.String);
method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
method public void sendUssdRequest(java.lang.String, int, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);

View File

@@ -42211,6 +42211,7 @@ package android.telephony {
method public boolean isWorldPhone();
method public void listen(android.telephony.PhoneStateListener, int);
method public boolean needsOtaServiceProvisioning();
method public boolean sendDialerCode(java.lang.String);
method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
method public void sendUssdRequest(java.lang.String, int, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);

View File

@@ -38993,6 +38993,7 @@ package android.telephony {
method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle);
method public boolean isWorldPhone();
method public void listen(android.telephony.PhoneStateListener, int);
method public boolean sendDialerCode(java.lang.String);
method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
method public void sendUssdRequest(java.lang.String, int, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);

View File

@@ -2912,6 +2912,30 @@ public class TelephonyManager {
}
}
/**
* Send the special dialer code. The IPC caller must be the current default dialer.
* <p>
* Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
*
* @param inputCode The special dialer code to send which follows the format of *#*#<code>#*#*
* @return true if sent sucessfully, false otherwise
*
*/
public boolean sendDialerCode(String inputCode) {
try {
final ITelephony telephony = getITelephony();
if (telephony == null) {
Log.e(TAG, "Telephony service unavailable");
return false;
}
return telephony.sendDialerCode(mContext.getOpPackageName(), inputCode);
} catch (RemoteException | NullPointerException ex) {
// This could happen before phone restarts due to crashing
return false;
}
}
/**
* Returns the IMS private user identity (IMPI) that was loaded from the ISIM.
* @return the IMPI, or null if not present or not loaded

View File

@@ -506,6 +506,9 @@ interface ITelephony {
oneway void sendVisualVoicemailSmsForSubscriber(in String callingPackage, in int subId,
in String number, in int port, in String text, in PendingIntent sentIntent);
// Send the special dialer code. The IPC caller must be the current default dialer.
boolean sendDialerCode(String callingPackageName, String inputCode);
/**
* Returns the network type for data transmission
* Legacy call, permission-free