Skip to content

Commit 3158cf6

Browse files
author
Wink Saville
committed
Change CDMAPhone.getDeviceId to return MEID or ESN.
This allows devices with only ESN's to work. bug: 2938223 Change-Id: I33939151c59f598b939e73d98f1178669d6ceb75
1 parent 11a7248 commit 3158cf6

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

telephony/java/android/telephony/TelephonyManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public String getDeviceSoftwareVersion() {
177177

178178
/**
179179
* Returns the unique device ID, for example, the IMEI for GSM and the MEID
180-
* for CDMA phones. Return null if device ID is not available.
180+
* or ESN for CDMA phones. Return null if device ID is not available.
181181
*
182182
* <p>Requires Permission:
183183
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}

telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,14 @@ public String getMeid() {
430430
return mMeid;
431431
}
432432

433-
//returns MEID in CDMA
433+
//returns MEID or ESN in CDMA
434434
public String getDeviceId() {
435-
return getMeid();
435+
String id = getMeid();
436+
if ((id == null) || id.matches("^0*$")) {
437+
Log.d(LOG_TAG, "getDeviceId(): MEID is not initialized use ESN");
438+
id = getEsn();
439+
}
440+
return id;
436441
}
437442

438443
public String getDeviceSvn() {

0 commit comments

Comments
 (0)