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

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
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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");