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

Commit 75f256cb authored by Meng Wang's avatar Meng Wang
Browse files

Skip notify celllocation of not really changed.

Readability cleanup.

Bug: 145949028
Test: make
Change-Id: I668a95f8f30ef6fdf6493fbc37757f3f97f76c9f
parent 4fb19f15
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);
                        }