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

Commit 87a79299 authored by Meng Wang's avatar Meng Wang Committed by Gerrit Code Review
Browse files

Merge "Skip notify celllocation of not really changed."

parents f3aeac8f 75f256cb
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -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);
                        }