Merge "Skip notify celllocation of not really changed." am: 87a7929958 am: 96e61153a1 am: 584c1588a6 am: 217369162b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1425373 Change-Id: Id74634de22b8580a1b73bb5709195e0cae2f8f59
This commit is contained in:
@@ -103,6 +103,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Since phone process can be restarted, this class provides a centralized place
|
* Since phone process can be restarted, this class provides a centralized place
|
||||||
@@ -1828,30 +1829,26 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyCellLocationForSubscriber(int subId, CellIdentity cellLocation) {
|
public void notifyCellLocationForSubscriber(int subId, CellIdentity cellIdentity) {
|
||||||
log("notifyCellLocationForSubscriber: subId=" + subId
|
log("notifyCellLocationForSubscriber: subId=" + subId
|
||||||
+ " cellLocation=" + cellLocation);
|
+ " cellIdentity=" + cellIdentity);
|
||||||
if (!checkNotifyPermission("notifyCellLocation()")) {
|
if (!checkNotifyPermission("notifyCellLocation()")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (VDBG) {
|
|
||||||
log("notifyCellLocationForSubscriber: subId=" + subId
|
|
||||||
+ " cellLocation=" + cellLocation);
|
|
||||||
}
|
|
||||||
int phoneId = getPhoneIdFromSubId(subId);
|
int phoneId = getPhoneIdFromSubId(subId);
|
||||||
synchronized (mRecords) {
|
synchronized (mRecords) {
|
||||||
if (validatePhoneId(phoneId)) {
|
if (validatePhoneId(phoneId) && !Objects.equals(cellIdentity, mCellIdentity[phoneId])) {
|
||||||
mCellIdentity[phoneId] = cellLocation;
|
mCellIdentity[phoneId] = cellIdentity;
|
||||||
for (Record r : mRecords) {
|
for (Record r : mRecords) {
|
||||||
if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_LOCATION) &&
|
if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_LOCATION) &&
|
||||||
idMatch(r.subId, subId, phoneId) &&
|
idMatch(r.subId, subId, phoneId) &&
|
||||||
checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
|
checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
|
||||||
try {
|
try {
|
||||||
if (DBG_LOC) {
|
if (DBG_LOC) {
|
||||||
log("notifyCellLocation: cellLocation=" + cellLocation
|
log("notifyCellLocation: cellIdentity=" + cellIdentity
|
||||||
+ " r=" + r);
|
+ " r=" + r);
|
||||||
}
|
}
|
||||||
r.callback.onCellLocationChanged(cellLocation);
|
r.callback.onCellLocationChanged(cellIdentity);
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
mRemoveList.add(r.binder);
|
mRemoveList.add(r.binder);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user