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

Commit 49599938 authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by Android (Google) Code Review
Browse files

Merge "Make sanitizeLocationInfo System Api."

parents 3833bdcb 00f7b72c
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -9763,6 +9763,7 @@ package android.telephony {
  }
  }
  public class ServiceState implements android.os.Parcelable {
  public class ServiceState implements android.os.Parcelable {
    method @NonNull public android.telephony.ServiceState createLocationInfoSanitizedCopy(boolean);
    method public int getDataRegistrationState();
    method public int getDataRegistrationState();
    method @Nullable public android.telephony.NetworkRegistrationInfo getNetworkRegistrationInfo(int, int);
    method @Nullable public android.telephony.NetworkRegistrationInfo getNetworkRegistrationInfo(int, int);
    method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoList();
    method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoList();
+6 −4
Original line number Original line Diff line number Diff line
@@ -785,9 +785,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                            if (checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
                            if (checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
                                r.callback.onServiceStateChanged(rawSs);
                                r.callback.onServiceStateChanged(rawSs);
                            } else if (checkCoarseLocationAccess(r, Build.VERSION_CODES.Q)) {
                            } else if (checkCoarseLocationAccess(r, Build.VERSION_CODES.Q)) {
                                r.callback.onServiceStateChanged(rawSs.sanitizeLocationInfo(false));
                                r.callback.onServiceStateChanged(
                                        rawSs.createLocationInfoSanitizedCopy(false));
                            } else {
                            } else {
                                r.callback.onServiceStateChanged(rawSs.sanitizeLocationInfo(true));
                                r.callback.onServiceStateChanged(
                                        rawSs.createLocationInfoSanitizedCopy(true));
                            }
                            }
                        } catch (RemoteException ex) {
                        } catch (RemoteException ex) {
                            remove(r.binder);
                            remove(r.binder);
@@ -1142,9 +1144,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                            if (checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
                            if (checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
                                stateToSend = new ServiceState(state);
                                stateToSend = new ServiceState(state);
                            } else if (checkCoarseLocationAccess(r, Build.VERSION_CODES.Q)) {
                            } else if (checkCoarseLocationAccess(r, Build.VERSION_CODES.Q)) {
                                stateToSend = state.sanitizeLocationInfo(false);
                                stateToSend = state.createLocationInfoSanitizedCopy(false);
                            } else {
                            } else {
                                stateToSend = state.sanitizeLocationInfo(true);
                                stateToSend = state.createLocationInfoSanitizedCopy(true);
                            }
                            }
                            if (DBG) {
                            if (DBG) {
                                log("notifyServiceStateForSubscriber: callback.onSSC r=" + r
                                log("notifyServiceStateForSubscriber: callback.onSSC r=" + r
+10 −1
Original line number Original line Diff line number Diff line
@@ -1950,9 +1950,18 @@ public class ServiceState implements Parcelable {
     * Returns a copy of self with location-identifying information removed.
     * Returns a copy of self with location-identifying information removed.
     * Always clears the NetworkRegistrationInfo's CellIdentity fields, but if removeCoarseLocation
     * Always clears the NetworkRegistrationInfo's CellIdentity fields, but if removeCoarseLocation
     * is true, clears other info as well.
     * is true, clears other info as well.
     *
     * @param removeCoarseLocation Whether to also remove coarse location information.
     *                             if false, it only clears fine location information such as
     *                             NetworkRegistrationInfo's CellIdentity fields; If true, it will
     *                             also remove other location information such as operator's MCC
     *                             and MNC.
     * @return the copied ServiceState with location info sanitized.
     * @hide
     * @hide
     */
     */
    public ServiceState sanitizeLocationInfo(boolean removeCoarseLocation) {
    @SystemApi
    @NonNull
    public ServiceState createLocationInfoSanitizedCopy(boolean removeCoarseLocation) {
        ServiceState state = new ServiceState(this);
        ServiceState state = new ServiceState(this);
        synchronized (state.mNetworkRegistrationInfos) {
        synchronized (state.mNetworkRegistrationInfos) {
            List<NetworkRegistrationInfo> networkRegistrationInfos =
            List<NetworkRegistrationInfo> networkRegistrationInfos =