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

Commit ac45e0c6 authored by Stuart Scott's avatar Stuart Scott Committed by Android Git Automerger
Browse files

am 1e2ca359: Merge "Change getDeviceId to take phoneId." into lmp-mr1-dev automerge: cdec2562

* commit '1e2ca359':
  Change getDeviceId to take phoneId.
parents ab2b9969 1e2ca359
Loading
Loading
Loading
Loading
+14 −15
Original line number Diff line number Diff line
@@ -44,16 +44,15 @@ public class PhoneSubInfoController extends IPhoneSubInfo.Stub {


    public String getDeviceId() {
        return getDeviceIdForSubscriber(getDefaultSubscription());
        return getDeviceIdForPhone(SubscriptionManager.getPhoneId(getDefaultSubscription()));
    }

    public String getDeviceIdForSubscriber(int subId) {
        PhoneSubInfoProxy phoneSubInfoProxy = getPhoneSubInfoProxy(subId);
        if (phoneSubInfoProxy != null) {
            return phoneSubInfoProxy.getDeviceId();
    public String getDeviceIdForPhone(int phoneId) {
        Phone phone = getPhone(phoneId);
        if (phone != null) {
            return phone.getDeviceId();
        } else {
            Rlog.e(TAG,"getDeviceId phoneSubInfoProxy is null" +
                      " for Subscription:" + subId);
            Rlog.e(TAG,"getDeviceIdForPhone phone " + phoneId + " is null");
            return null;
        }
    }
@@ -223,23 +222,23 @@ public class PhoneSubInfoController extends IPhoneSubInfo.Stub {
    private PhoneSubInfoProxy getPhoneSubInfoProxy(int subId) {

        int phoneId = SubscriptionManager.getPhoneId(subId);
        if (phoneId < 0 || phoneId >= TelephonyManager.getDefault().getPhoneCount()) {
            phoneId = 0;
        }

        try {
            return ((PhoneProxy)mPhone[(int)phoneId]).getPhoneSubInfoProxy();
            return getPhone(phoneId).getPhoneSubInfoProxy();
        } catch (NullPointerException e) {
            Rlog.e(TAG, "Exception is :" + e.toString() + " For subId :" + subId);
            e.printStackTrace();
            return null;
        } catch (ArrayIndexOutOfBoundsException e) {
            Rlog.e(TAG, "Exception is :" + e.toString() + " For subId :" + subId);
            e.printStackTrace();
            return null;
        }
    }

    private PhoneProxy getPhone(int phoneId) {
        if (phoneId < 0 || phoneId >= TelephonyManager.getDefault().getPhoneCount()) {
            phoneId = 0;
        }
        return (PhoneProxy) mPhone[phoneId];
    }

    private int getDefaultSubscription() {
        return  PhoneFactory.getDefaultSubscription();
    }
+2 −2
Original line number Diff line number Diff line
@@ -152,8 +152,8 @@ public class PhoneSubInfoProxy extends IPhoneSubInfo.Stub {
    }

    @Override
    public String getDeviceIdForSubscriber(int subId) throws RemoteException {
        // FIXME: getDeviceIdForSubscriber
    public String getDeviceIdForPhone(int phoneId) throws RemoteException {
        // FIXME: getDeviceIdForPhone
        return null;
    }