Merge "Not allow usage of satellite communication through mock location" into 24D1-dev
diff --git a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
index acf1205..0ffbdc5 100644
--- a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
+++ b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
@@ -969,11 +969,17 @@
synchronized (mLock) {
stopWaitForCurrentLocationTimer();
mLocationRequestCancellationSignal = null;
+ Bundle bundle = new Bundle();
if (location != null) {
+ if (location.isMock() && !isMockModemAllowed()) {
+ logd("location is mock");
+ bundle.putBoolean(KEY_SATELLITE_COMMUNICATION_ALLOWED, false);
+ sendSatelliteAllowResultToReceivers(SATELLITE_RESULT_SUCCESS, bundle, false);
+ return;
+ }
checkSatelliteAccessRestrictionForLocation(location);
} else {
logd("current location is not available");
- Bundle bundle = new Bundle();
if (isCommunicationAllowedCacheValid()) {
logd("onCurrentLocationAvailable: 24Hr cache is still valid, using it");
bundle.putBoolean(KEY_SATELLITE_COMMUNICATION_ALLOWED,
@@ -1145,7 +1151,12 @@
result = location;
}
}
- return result;
+
+ if (result == null || isMockModemAllowed()) {
+ return result;
+ }
+
+ return result.isMock() ? null : result;
}
private void initSharedPreferences(@NonNull Context context) {