Loading src/com/android/dialer/SpecialCharSequenceMgr.java +23 −50 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ import android.widget.Toast; import com.android.common.io.MoreCloseables; import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler; import java.util.ArrayList; import java.util.List; /** * Helper class to listen for some magic character sequences * that are handled specially by the dialer. Loading Loading @@ -80,20 +83,10 @@ public class SpecialCharSequenceMgr { } public static boolean handleChars(Context context, String input, EditText textField) { return handleChars(context, input, false, textField); } static boolean handleChars(Context context, String input) { return handleChars(context, input, false, null); } static boolean handleChars(Context context, String input, boolean useSystemWindow, EditText textField) { //get rid of the separators so that the string gets parsed correctly String dialString = PhoneNumberUtils.stripSeparators(input); if (handleIMEIDisplay(context, dialString, useSystemWindow) if (handleDeviceIdDisplay(context, dialString) || handleRegulatoryInfoDisplay(context, dialString) || handlePinEntry(context, dialString) || handleAdnEntry(context, dialString, textField) Loading Loading @@ -233,20 +226,30 @@ public class SpecialCharSequenceMgr { return false; } static boolean handleIMEIDisplay(Context context, String input, boolean useSystemWindow) { // TODO: Use TelephonyCapabilities.getDeviceIdLabel() to get the device id label instead of a // hard-coded string. static boolean handleDeviceIdDisplay(Context context, String input) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null && input.equals(MMI_IMEI_DISPLAY)) { int phoneType = telephonyManager.getPhoneType(); if (phoneType == TelephonyManager.PHONE_TYPE_GSM) { showIMEIPanel(context, useSystemWindow, telephonyManager); return true; } else if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) { showMEIDPanel(context, useSystemWindow, telephonyManager); return true; } int labelResId = (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) ? R.string.imei : R.string.meid; List<String> deviceIds = new ArrayList<String>(); for (int slot = 0; slot < telephonyManager.getPhoneCount(); slot++) { deviceIds.add(telephonyManager.getDeviceId(slot)); } AlertDialog alert = new AlertDialog.Builder(context) .setTitle(labelResId) .setItems(deviceIds.toArray(new String[deviceIds.size()]), null) .setPositiveButton(R.string.ok, null) .setCancelable(false) .show(); return true; } return false; } Loading @@ -264,36 +267,6 @@ 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.) private static void showIMEIPanel(Context context, boolean useSystemWindow, TelephonyManager telephonyManager) { String imeiStr = telephonyManager.getDeviceId(); AlertDialog alert = new AlertDialog.Builder(context) .setTitle(R.string.imei) .setMessage(imeiStr) .setPositiveButton(android.R.string.ok, null) .setCancelable(false) .show(); } private static void showMEIDPanel(Context context, boolean useSystemWindow, TelephonyManager telephonyManager) { String meidStr = telephonyManager.getDeviceId(); AlertDialog alert = new AlertDialog.Builder(context) .setTitle(R.string.meid) .setMessage(meidStr) .setPositiveButton(android.R.string.ok, null) .setCancelable(false) .show(); } /******* * This code is used to handle SIM Contact queries *******/ Loading Loading
src/com/android/dialer/SpecialCharSequenceMgr.java +23 −50 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ import android.widget.Toast; import com.android.common.io.MoreCloseables; import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler; import java.util.ArrayList; import java.util.List; /** * Helper class to listen for some magic character sequences * that are handled specially by the dialer. Loading Loading @@ -80,20 +83,10 @@ public class SpecialCharSequenceMgr { } public static boolean handleChars(Context context, String input, EditText textField) { return handleChars(context, input, false, textField); } static boolean handleChars(Context context, String input) { return handleChars(context, input, false, null); } static boolean handleChars(Context context, String input, boolean useSystemWindow, EditText textField) { //get rid of the separators so that the string gets parsed correctly String dialString = PhoneNumberUtils.stripSeparators(input); if (handleIMEIDisplay(context, dialString, useSystemWindow) if (handleDeviceIdDisplay(context, dialString) || handleRegulatoryInfoDisplay(context, dialString) || handlePinEntry(context, dialString) || handleAdnEntry(context, dialString, textField) Loading Loading @@ -233,20 +226,30 @@ public class SpecialCharSequenceMgr { return false; } static boolean handleIMEIDisplay(Context context, String input, boolean useSystemWindow) { // TODO: Use TelephonyCapabilities.getDeviceIdLabel() to get the device id label instead of a // hard-coded string. static boolean handleDeviceIdDisplay(Context context, String input) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null && input.equals(MMI_IMEI_DISPLAY)) { int phoneType = telephonyManager.getPhoneType(); if (phoneType == TelephonyManager.PHONE_TYPE_GSM) { showIMEIPanel(context, useSystemWindow, telephonyManager); return true; } else if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) { showMEIDPanel(context, useSystemWindow, telephonyManager); return true; } int labelResId = (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) ? R.string.imei : R.string.meid; List<String> deviceIds = new ArrayList<String>(); for (int slot = 0; slot < telephonyManager.getPhoneCount(); slot++) { deviceIds.add(telephonyManager.getDeviceId(slot)); } AlertDialog alert = new AlertDialog.Builder(context) .setTitle(labelResId) .setItems(deviceIds.toArray(new String[deviceIds.size()]), null) .setPositiveButton(R.string.ok, null) .setCancelable(false) .show(); return true; } return false; } Loading @@ -264,36 +267,6 @@ 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.) private static void showIMEIPanel(Context context, boolean useSystemWindow, TelephonyManager telephonyManager) { String imeiStr = telephonyManager.getDeviceId(); AlertDialog alert = new AlertDialog.Builder(context) .setTitle(R.string.imei) .setMessage(imeiStr) .setPositiveButton(android.R.string.ok, null) .setCancelable(false) .show(); } private static void showMEIDPanel(Context context, boolean useSystemWindow, TelephonyManager telephonyManager) { String meidStr = telephonyManager.getDeviceId(); AlertDialog alert = new AlertDialog.Builder(context) .setTitle(R.string.meid) .setMessage(meidStr) .setPositiveButton(android.R.string.ok, null) .setCancelable(false) .show(); } /******* * This code is used to handle SIM Contact queries *******/ Loading