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

Commit 755612f5 authored by kaiyiz's avatar kaiyiz Committed by Steve Kondik
Browse files

Dialer: Customize features for regional package

1. Add engineering mode secret code "*#7548135*#";
2. Use secret code to trigger factory test mode;
3. Hide diag port and to open diag port menu need to dial *76278#.

Change-Id: Iae26756824f1f2cc9693546eb39a1a45761e4f88
(cherry picked from commit 144951edf8fdc556f81ca7e1bee180a4ba64f9d4)
parent 49993d0b
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2014, The Linux Foundation. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the following
      disclaimer in the documentation and/or other materials provided
      with the distribution.
    * Neither the name of The Linux Foundation nor the names of its
      contributors may be used to endorse or promote products derived
      from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<resources>

    <!--
         Customize persist.env.settings.diagport values, default value is false,
            true is for Smartfren
    -->
    <bool name="def_dialer_settings_diagport_enabled">false</bool>

    <!--
         Customize persist.secretcode.ftm values, default value is false,
            true is for Smartfren
    -->
    <bool name="def_dialer_secretcode_enabled">false</bool>

</resources>
 No newline at end of file
+58 −7
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@ public class SpecialCharSequenceMgr {
    private static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE";
    private static final String MMI_IMEI_DISPLAY = "*#06#";
    private static final String MMI_REGULATORY_INFO_DISPLAY = "*#07#";
    private static final String MMI_OPEN_DIAG_MENU_DISPLAY = "*76278#";
    private static final String MMI_FACTORY_MODE_DISPLAY = "#38378#";
    private static final String MMI_ENGINEER_MODE_DISPLAY = "*#7548135*#";
    private static final String PRL_VERSION_DISPLAY = "*#0000#";

    /**
@@ -97,14 +100,30 @@ public class SpecialCharSequenceMgr {
        //get rid of the separators so that the string gets parsed correctly
        String dialString = PhoneNumberUtils.stripSeparators(input);

        if (context.getResources().getBoolean(R.bool.def_dialer_secretcode_enabled) ||
                context.getResources().getBoolean(R.bool.def_dialer_settings_diagport_enabled)) {
            if (handlePRLVersion(context, dialString)
                    || handleIMEIDisplay(context, dialString, useSystemWindow)
                    || handleRegulatoryInfoDisplay(context, dialString)
                    || handleEngineerModeDisplay(context, dialString)
                    || handlePinEntry(context, dialString)
                    || handleAdnEntry(context, dialString, textField)
                    || handleSecretCode(context, dialString)
                    || handleFactorySetCode(context, dialString)
                    || handleSetDiagPortCode(context, dialString)) {
                return true;
            }
        } else {
            if (handlePRLVersion(context, dialString)
                    || handleIMEIDisplay(context, dialString, useSystemWindow)
                    || handleRegulatoryInfoDisplay(context, dialString)
                    || handleEngineerModeDisplay(context, dialString)
                    || handlePinEntry(context, dialString)
                    || handleAdnEntry(context, dialString, textField)
                    || handleSecretCode(context, dialString)) {
                return true;
            }
        }

        return false;
    }
@@ -123,6 +142,17 @@ public class SpecialCharSequenceMgr {
        return false;
    }

    static private boolean handleSetDiagPortCode(Context context, String input) {
        int len = input.length();
        if (input.equals(MMI_OPEN_DIAG_MENU_DISPLAY)) {
            Intent intent = new Intent(SECRET_CODE_ACTION,
                    Uri.parse("android_secret_code://" + input.substring(1, len - 1)));
            context.sendBroadcast(intent);
            return true;
        }
        return false;
    }

    /**
     * Cleanup everything around this class. Must be run inside the main thread.
     *
@@ -162,6 +192,17 @@ public class SpecialCharSequenceMgr {
        return false;
    }

    static boolean handleFactorySetCode(Context context, String input) {
        int len = input.length();
        if (input.equals(MMI_FACTORY_MODE_DISPLAY)) {
            Intent intent = new Intent(SECRET_CODE_ACTION,
                    Uri.parse("android_secret_code://" + input.substring(1, len - 1)));
            context.sendBroadcast(intent);
            return true;
        }
        return false;
    }

    /**
     * Handle ADN requests by filling in the SIM contact number into the requested
     * EditText.
@@ -365,6 +406,16 @@ public class SpecialCharSequenceMgr {
                .show();
    }

    static boolean handleEngineerModeDisplay(Context context, String input) {
        if (input.equals(MMI_ENGINEER_MODE_DISPLAY)) {
            Intent intent = new Intent(SECRET_CODE_ACTION,
                    Uri.parse("android_secret_code://3878"));
            context.sendBroadcast(intent);
            return true;
        }
        return false;
    }

    /*******
     * This code is used to handle SIM Contact queries
     *******/