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

Commit 66de2824 authored by Ruijie Bai's avatar Ruijie Bai Committed by takeshi tanigawa
Browse files

Returns null not empty string if MEID is not available

TelephonyManager#getMeid is defined to return null if MEID is not
available. However, it may return an empty string. Because Modem returns
an empty string if a device doesn't support CDMA. Therefore, change to
return null if MEID is empty.

Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases -t 
com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement
Bug: 140472124

Change-Id: I822c352854516e898bbe3d7a6710ecb085991b1b
parent 0e6683ef
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1812,7 +1812,12 @@ public class TelephonyManager {
        if (telephony == null) return null;

        try {
            return telephony.getMeidForSlot(slotIndex, getOpPackageName());
            String meid = telephony.getMeidForSlot(slotIndex, getOpPackageName());
            if (TextUtils.isEmpty(meid)) {
                Log.d(TAG, "getMeid: return null because MEID is not available");
                return null;
            }
            return meid;
        } catch (RemoteException ex) {
            return null;
        } catch (NullPointerException ex) {