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

Commit 5c386e80 authored by David Brown's avatar David Brown
Browse files

Fix crash with MMI code *#06#

The code was calling getWindow().setType() on the IMEI dialog *after*
showing it.  The code had been doing that all along, but starting about a
week ago (change Iac63da) the framework now also throws an exception if
you do that :-(

Turns out there's no need to set TYPE_PRIORITY_PHONE in this case anyway,
since the dialer UI can't run on top of the keyguard in the first place
(and the contacts app doesn't have the SYSTEM_ALERT_WINDOW permission
anyway.)  So just remove the offending call.

(Note there's also a corresponding fix under apps/Phone for this same
issue.  Also, I double-checked all the *other* Window.setType() calls in
Phone and Contacts, and we don't have this same problem anywhere else.)

TESTED: Launch dialer, dial "*#06#": IMEI panel correctly comes up.

Bug: 5279270

Change-Id: Ie19ec1414fc6096ee2c84fe716259304bff7a33b
parent b2ef6d86
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -42,6 +42,10 @@ import android.widget.Toast;
 * Helper class to listen for some magic character sequences
 * that are handled specially by the dialer.
 *
 * Note the Phone app also handles these sequences too (in a couple of
 * relativly obscure places in the UI), so there's a separate version of
 * this class under apps/Phone.
 *
 * TODO: there's lots of duplicated code between this class and the
 * corresponding class under apps/Phone.  Let's figure out a way to
 * unify these two classes (in the framework? in a common shared library?)
@@ -198,6 +202,12 @@ public class SpecialCharSequenceMgr {
        return false;
    }

    // TODO: Combine showIMEIPanel() and showMEIDPanel() into a single
    // generic "showDeviceIdPanel()" method, like in the apps/Phone
    // version of SpecialCharSequenceMgr.java.  (This will require moving
    // the phone app's TelephonyCapabilities.getDeviceIdLabel() method
    // into the telephony framework, though.)

    static void showIMEIPanel(Context context, boolean useSystemWindow) {
        String imeiStr = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE))
                .getDeviceId();
@@ -208,7 +218,6 @@ public class SpecialCharSequenceMgr {
                .setPositiveButton(android.R.string.ok, null)
                .setCancelable(false)
                .show();
        alert.getWindow().setType(WindowManager.LayoutParams.TYPE_PRIORITY_PHONE);
    }

    static void showMEIDPanel(Context context, boolean useSystemWindow) {
@@ -221,7 +230,6 @@ public class SpecialCharSequenceMgr {
                .setPositiveButton(android.R.string.ok, null)
                .setCancelable(false)
                .show();
        alert.getWindow().setType(WindowManager.LayoutParams.TYPE_PRIORITY_PHONE);
    }

    /*******