use telephony API to sent secret dial code
Telephony provides an API to send secret code broadcast in a
bgcheck compliant way.
Bug:33753947
Test: Manual
Change-Id: Ibe0968a193c026f8a234af88ad5e72beebaa83f4
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 52c5621..4e4dc30 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -2066,6 +2066,30 @@
}
/**
+ * Send the dialer code if called from the current default dialer and the input code follows the
+ * format of *#*#<code>#*#*
+ * <p>
+ * Requires Permission:
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ *
+ * @param inputCode The dialer code to send
+ * @return true if successfully sent, false otherwise
+ */
+ @Override
+ public boolean sendDialerCode(String callingPackage, String inputCode) {
+ enforceModifyPermission();
+ mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
+ if (TextUtils.equals(callingPackage,
+ TelecomManager.from(mPhone.getContext()).getDefaultDialerPackage())) {
+ final Phone phone = getPhone(getDefaultSubscription());
+ if (phone != null) {
+ return phone.sendDialerCode(inputCode);
+ }
+ }
+ return false;
+ }
+
+ /**
* Returns the data network type.
* Legacy call, permission-free.
*