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

This commit is contained in:
xinhe
2014-10-16 22:37:42 +00:00
committed by Android (Google) Code Review

View File

@@ -346,10 +346,10 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
+ " notifyNow=" + notifyNow + " subId=" + subId + " myUid=" + myUid + " notifyNow=" + notifyNow + " subId=" + subId + " myUid=" + myUid
+ " callerUid=" + callerUid); + " callerUid=" + callerUid);
} }
if (events != 0) {
if (events != PhoneStateListener.LISTEN_NONE) {
/* Checks permission and throws Security exception */ /* Checks permission and throws Security exception */
checkListenerPermission(events); checkListenerPermission(events);
synchronized (mRecords) { synchronized (mRecords) {
// register // register
Record r = null; Record r = null;
@@ -364,26 +364,26 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
r = new Record(); r = new Record();
r.binder = b; r.binder = b;
r.callback = callback;
r.pkgForDebug = pkgForDebug;
r.callerUid = callerUid;
// Legacy applications pass SubscriptionManager.DEFAULT_SUB_ID,
// force all illegal subId to SubscriptionManager.DEFAULT_SUB_ID
if (!SubscriptionManager.isValidSubId(subId)) {
r.subId = SubscriptionManager.DEFAULT_SUB_ID;
} else {//APP specify subID
r.subId = subId;
}
r.phoneId = SubscriptionManager.getPhoneId(r.subId);
mRecords.add(r); mRecords.add(r);
if (DBG) log("listen: add new record"); if (DBG) log("listen: add new record");
} }
r.callback = callback;
r.pkgForDebug = pkgForDebug;
r.callerUid = callerUid;
// Legacy applications pass SubscriptionManager.DEFAULT_SUB_ID,
// force all illegal subId to SubscriptionManager.DEFAULT_SUB_ID
if (!SubscriptionManager.isValidSubId(subId)) {
r.subId = SubscriptionManager.DEFAULT_SUB_ID;
} else {//APP specify subID
r.subId = subId;
}
r.phoneId = SubscriptionManager.getPhoneId(r.subId);
int phoneId = r.phoneId; int phoneId = r.phoneId;
r.events = events; r.events = events;
if (DBG) { 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 (VDBG) toStringLogSSC("listen");
if (notifyNow && validatePhoneId(phoneId)) { if (notifyNow && validatePhoneId(phoneId)) {
@@ -503,6 +503,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
} }
} else { } else {
if(DBG) log("listen: Unregister");
remove(callback.asBinder()); remove(callback.asBinder());
} }
} }