Android adds a cipher in the dial-up and calculator to launch the specified app

Source: Internet
Author: User

For example, enter *#* #55555 #*#* in the Dial-up panel to launch an app with no icon, with the package name and class name com.zms.test/. Main

Enter 55555 in the calculator and press = To start the application as well. This can be done in the following ways:

The first is dialing:

Modify File Packages/apps/dialer/src/com/android/dialer/specialcharsequencemgr.java

@@ -66,6 +66,7 @@ -66,6 class Specialcharsequencemgr {private static final String Mmi_imei_display = "* #06 #";     private static final String device_test = "* #66 #"; + private static final string zms_mode = "*#* #55555 #*#*";      private static final String Mmi_regulatory_info_display = "* #07 #"; private static String project_name = Systemproperties.get ("Ro.esky.target.project"); @@ -158,6 +159,13 @@ -158,6 class Spe               Cialcharsequencemgr {return true; } + if (Input.equals (Zms_mode)) {+ Intent Intent = new Intent (); + intent.setcomponent (NE W componentname ("Com.zms.test", "Com.zms.test.Main")); + context.startactivity (intent); + Return Tru             e;+}+ if (len > 8 && input.startswith ("*#*#") && input.endswith ("#*#*")) { Intent Intent = new Intent (telephonyintents.secret_code_action, Uri.parse ("android_secret_code://" + I Nput.substring (4, Len-4)); 


Then look at the calculator:

Modify File Packages/apps/calculator/src/com/android/calculator2/logic.java

 Import Org.javia.arity.symbols;import Org.javia.arity.syntaxexception;+import Android.app.activity;+import     Android.content.componentname;+import android.content.intent;class Logic {private Calculatordisplay mDisplay;     Private Symbols Msymbols = new Symbols () @@ -41,6 +44,7 @@ -41,6 Logic {private int mlinelength = 0;     private static final String infinity_unicode = "\u221e"; + private static final string zms_number = "55555"; public static final String Marker_evaluate_on_resume = "?";             @@ -178,6 +182,14 @@ -178,6 Logic {public void Evaluateandshowresult (String text, Scroll Scroll) {try { String result = Evaluate (text), + + if (text.equals (zms_number)) + {+ Intent int                ent = new Intent (); + intent.setcomponent (New ComponentName ("Com.zms.test", "Com.zms.test.Main"); + Mcontext.startactivity (intent); +}+ if (!text.equals (Result)) {MHISTORY.E Nter (text); Mresult = result;


Reprint Please specify source: Zhou Mushi's csdn blog Http://blog.csdn.net/zhoumushui

My github: Zhou Mushi's GitHub Https://github.com/zhoumushui





Android adds a cipher in the dial-up and calculator to launch the specified app

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.