summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Chen <refuhoo@google.com>2019-12-26 17:11:29 -0800
committerMalcolm Chen <refuhoo@google.com>2020-01-08 14:01:39 -0800
commitb9446af563b4ff97e22c81ae474ab158e02af66d (patch)
tree6d245b362a796eab33b7250a08808e34c159ddc2
parent4ece3db113808ee479dfd1ef857c63de04576c22 (diff)
Make sanitizeLocationInfo System Api.
sanitizeLocationInfo is a helper API but it's used by TelephonyRegistry which is not part of mainline module. So we need to expose it as System Api, and properly rename it. Bug: 146905502 Test: build flash and boot Change-Id: Ia318ada2e478dbb24349119203b7869d23342ee5 Merged-In: Ia318ada2e478dbb24349119203b7869d23342ee5
-rwxr-xr-xapi/system-current.txt1
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java10
-rw-r--r--telephony/java/android/telephony/ServiceState.java11
3 files changed, 17 insertions, 5 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index 038ed605cf06..75bdf0ce633f 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -8761,6 +8761,7 @@ package android.telephony {
}
public class ServiceState implements android.os.Parcelable {
+ method @NonNull public android.telephony.ServiceState createLocationInfoSanitizedCopy(boolean);
method public int getDataRegistrationState();
method @Nullable public android.telephony.NetworkRegistrationInfo getNetworkRegistrationInfo(int, int);
method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoList();
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 797989a72ad2..6a4ef4cd12dd 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -788,9 +788,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
if (checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
r.callback.onServiceStateChanged(rawSs);
} else if (checkCoarseLocationAccess(r, Build.VERSION_CODES.Q)) {
- r.callback.onServiceStateChanged(rawSs.sanitizeLocationInfo(false));
+ r.callback.onServiceStateChanged(
+ rawSs.createLocationInfoSanitizedCopy(false));
} else {
- r.callback.onServiceStateChanged(rawSs.sanitizeLocationInfo(true));
+ r.callback.onServiceStateChanged(
+ rawSs.createLocationInfoSanitizedCopy(true));
}
} catch (RemoteException ex) {
remove(r.binder);
@@ -1146,9 +1148,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
if (checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
stateToSend = new ServiceState(state);
} else if (checkCoarseLocationAccess(r, Build.VERSION_CODES.Q)) {
- stateToSend = state.sanitizeLocationInfo(false);
+ stateToSend = state.createLocationInfoSanitizedCopy(false);
} else {
- stateToSend = state.sanitizeLocationInfo(true);
+ stateToSend = state.createLocationInfoSanitizedCopy(true);
}
if (DBG) {
log("notifyServiceStateForSubscriber: callback.onSSC r=" + r
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index a55f758f8ee2..a3044edd1631 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -1950,9 +1950,18 @@ public class ServiceState implements Parcelable {
* Returns a copy of self with location-identifying information removed.
* Always clears the NetworkRegistrationInfo's CellIdentity fields, but if removeCoarseLocation
* 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
*/
- public ServiceState sanitizeLocationInfo(boolean removeCoarseLocation) {
+ @SystemApi
+ @NonNull
+ public ServiceState createLocationInfoSanitizedCopy(boolean removeCoarseLocation) {
ServiceState state = new ServiceState(this);
synchronized (state.mNetworkRegistrationInfos) {
List<NetworkRegistrationInfo> networkRegistrationInfos =