Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6fac8fa authored by fionaxu's avatar fionaxu Committed by Chen Xu
Browse files

remove deprecated API sendDialerCode

Bug: 35767402
Test: run cts -m CtsPermissionTestCases -t
android.permission.cts.TelephonyManagerPermissionTest

Change-Id: I4a496ac335255ba6397b7f9261ba1a16c0534b85
parent 48126ef8
Loading
Loading
Loading
Loading
+0 −24
Original line number Diff line number Diff line
@@ -2277,30 +2277,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return countVoiceMessages;
    }

    /**
     * send secret dialer codes to launch arbitrary activities in the form of *#*#<code>#*#*.
     * If a secret code is encountered, an Intent is started with the android_secret_code://<code>
     * URI.
     *
     * @param code the text to check for a secret code in
     * @return true if a secret code was encountered
     */
    public boolean sendDialerCode(String code) {
        // Secret dialer codes are in the form *#*#<code>#*#*
        if (TextUtils.isEmpty(code)) {
            return false;
        }
        int len = code.length();
        if (len > 8 && code.startsWith("*#*#") && code.endsWith("#*#*")) {
            Intent intent = new Intent(TelephonyIntents.SECRET_CODE_ACTION,
                    Uri.parse("android_secret_code://" + code.substring(4, len - 4)));
            intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
            mContext.sendBroadcast(intent);
            return true;
        }
        return false;
    }

    /**
     * send secret dialer codes to launch arbitrary activities.
     * an Intent is started with the android_secret_code://<code> URI.