Skip to content
Snippets Groups Projects
Commit a6499549 authored by Rubin Xu's avatar Rubin Xu Committed by Android (Google) Code Review
Browse files

Merge "Guard against exception from TelephonyManager.getMeid()" into main

parents a74c6050 977d9a5c
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,17 @@ class EnterpriseSpecificIdCalculator {
TelephonyManager telephonyService = context.getSystemService(TelephonyManager.class);
Preconditions.checkState(telephonyService != null, "Unable to access telephony service");
mImei = telephonyService.getImei(0);
mMeid = telephonyService.getMeid(0);
String meid;
try {
meid = telephonyService.getMeid(0);
} catch (UnsupportedOperationException doesNotSupportCdma) {
// Instead of catching the exception, we could check for FEATURE_TELEPHONY_CDMA.
// However that runs the risk of changing a device's existing ESID if on these devices
// telephonyService.getMeid() actually returns non-null even when the device does not
// declare FEATURE_TELEPHONY_CDMA.
meid = null;
}
mMeid = meid;
mSerialNumber = Build.getSerial();
WifiManager wifiManager = context.getSystemService(WifiManager.class);
Preconditions.checkState(wifiManager != null, "Unable to access WiFi service");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment