add an API for sending secret dialer code
Telephony provides an pulic API for sending secret dialer code with the format of *#*#code*#*#. This API only sent out broadcast for the default dialer app and is backgound-check compliant. Bug:33753947 Test: Manual Change-Id: I10665828e88be07d96c7f2568a0c6878abe2e21b
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user