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

Commit efdddefa authored by xinhe's avatar xinhe Committed by Android (Google) Code Review
Browse files

Merge "telephony re-registry error" into lmp-mr1-dev

parents b08ee9b7 75c2c159
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -346,10 +346,10 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                + " notifyNow=" + notifyNow + " subId=" + subId + " myUid=" + myUid
                + " callerUid=" + callerUid);
        }
        if (events != 0) {

        if (events != PhoneStateListener.LISTEN_NONE) {
            /* Checks permission and throws Security exception */
            checkListenerPermission(events);

            synchronized (mRecords) {
                // register
                Record r = null;
@@ -364,6 +364,10 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    }
                    r = new Record();
                    r.binder = b;
                    mRecords.add(r);
                    if (DBG) log("listen: add new record");
                }

                r.callback = callback;
                r.pkgForDebug = pkgForDebug;
                r.callerUid = callerUid;
@@ -376,14 +380,10 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                }
                r.phoneId = SubscriptionManager.getPhoneId(r.subId);

                    mRecords.add(r);
                    if (DBG) log("listen: add new record");
                }

                int phoneId = r.phoneId;
                r.events = events;
                if (DBG) {
                    log("listen: r=" + r + " r.subId=" + r.subId + " phoneId=" + phoneId);
                    log("listen:  Register r=" + r + " r.subId=" + r.subId + " phoneId=" + phoneId);
                }
                if (VDBG) toStringLogSSC("listen");
                if (notifyNow && validatePhoneId(phoneId)) {
@@ -503,6 +503,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                }
            }
        } else {
            if(DBG) log("listen: Unregister");
            remove(callback.asBinder());
        }
    }