From 0f4ec2a7c965a8fa23fa32373fbdbbb3e4be1ea4 Mon Sep 17 00:00:00 2001 From: Nancy Chen Date: Mon, 23 Mar 2015 15:03:03 -0700 Subject: Fix NPE in device ID dialog. Do not add null strings to list of device ids when responding to MMI code for device ids (IMEI/MEID). Also fix string resource that is not available in AOSP. Bug: 19897433 Change-Id: Ie06bb793eafa66f451bf1843d2a5ad4d343999d2 --- src/com/android/dialer/SpecialCharSequenceMgr.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/com/android/dialer/SpecialCharSequenceMgr.java') diff --git a/src/com/android/dialer/SpecialCharSequenceMgr.java b/src/com/android/dialer/SpecialCharSequenceMgr.java index f466c417c..46c6de6c9 100644 --- a/src/com/android/dialer/SpecialCharSequenceMgr.java +++ b/src/com/android/dialer/SpecialCharSequenceMgr.java @@ -33,6 +33,7 @@ import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; +import android.text.TextUtils; import android.util.Log; import android.view.WindowManager; import android.widget.EditText; @@ -310,13 +311,16 @@ public class SpecialCharSequenceMgr { List deviceIds = new ArrayList(); for (int slot = 0; slot < telephonyManager.getPhoneCount(); slot++) { - deviceIds.add(telephonyManager.getDeviceId(slot)); + String deviceId = telephonyManager.getDeviceId(slot); + if (!TextUtils.isEmpty(deviceId)) { + deviceIds.add(deviceId); + } } AlertDialog alert = new AlertDialog.Builder(context) .setTitle(labelResId) .setItems(deviceIds.toArray(new String[deviceIds.size()]), null) - .setPositiveButton(R.string.ok, null) + .setPositiveButton(android.R.string.ok, null) .setCancelable(false) .show(); return true; -- cgit v1.2.3