/** * 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. * * @param telecomManager The {@link TelecomManager} object to use for handling MMI. * @param dialString The digits to dial. * @return {@code true} if the digits were processed as an MMI code, {@code false} otherwise. */ public static boolean handleMmi(@Nullable TelecomManager telecomManager, @Nullable String dialString, @Nullable PhoneAccountHandle accountHandle) { if (telecomManager == null || TextUtils.isEmpty(dialString)) { return false; } if (CompatUtils.isMarshmallowCompatible()) { return telecomManager.handleMmi(dialString, accountHandle); } Object handleMmiResult = CompatUtils.invokeMethod( telecomManager, "handleMmi", new Class<?>[] {PhoneAccountHandle.class, String.class}, new Object[] {accountHandle, dialString}); if (handleMmiResult != null) { return (boolean) handleMmiResult; } return telecomManager.handleMmi(dialString); }