Skip notify celllocation of not really changed.

Readability cleanup.

Bug: 145949028
Test: make
Change-Id: I668a95f8f30ef6fdf6493fbc37757f3f97f76c9f
This commit is contained in:
Meng Wang
2020-09-11 17:17:09 -07:00
parent 4fb19f1550
commit 75f256cb08

View File

@@ -103,6 +103,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
/**
* Since phone process can be restarted, this class provides a centralized place
@@ -1828,30 +1829,26 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
@Override
public void notifyCellLocationForSubscriber(int subId, CellIdentity cellLocation) {
public void notifyCellLocationForSubscriber(int subId, CellIdentity cellIdentity) {
log("notifyCellLocationForSubscriber: subId=" + subId
+ " cellLocation=" + cellLocation);
+ " cellIdentity=" + cellIdentity);
if (!checkNotifyPermission("notifyCellLocation()")) {
return;
}
if (VDBG) {
log("notifyCellLocationForSubscriber: subId=" + subId
+ " cellLocation=" + cellLocation);
}
int phoneId = getPhoneIdFromSubId(subId);
synchronized (mRecords) {
if (validatePhoneId(phoneId)) {
mCellIdentity[phoneId] = cellLocation;
if (validatePhoneId(phoneId) && !Objects.equals(cellIdentity, mCellIdentity[phoneId])) {
mCellIdentity[phoneId] = cellIdentity;
for (Record r : mRecords) {
if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_LOCATION) &&
idMatch(r.subId, subId, phoneId) &&
checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
try {
if (DBG_LOC) {
log("notifyCellLocation: cellLocation=" + cellLocation
log("notifyCellLocation: cellIdentity=" + cellIdentity
+ " r=" + r);
}
r.callback.onCellLocationChanged(cellLocation);
r.callback.onCellLocationChanged(cellIdentity);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}