Throw SecurityException for Q+ getNeighboringCellInfo
If a caller of getNeighboringCellInfo() is targeting a
Q+ SDK level, then the API is unavailable. It will be
@removed (soon), so it should just not be called.
Bug: 112440821
Test: NoLocationPermissionTest#testListenCellLocation2
Change-Id: Ibd4f3e378411a6d4695aefb16dafeeaeea08ca48
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index a97c4b3..145c21f 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1922,7 +1922,10 @@
@SuppressWarnings("unchecked")
public List<NeighboringCellInfo>
getNeighboringCellInfo(String callingPackage, int targetSdk) {
- if (targetSdk > android.os.Build.VERSION_CODES.P) return null;
+ if (targetSdk >= android.os.Build.VERSION_CODES.Q) {
+ throw new SecurityException(
+ "getNeighboringCellInfo() is unavailable to callers targeting Q+ SDK levels.");
+ }
if (mAppOps.noteOp(AppOpsManager.OP_NEIGHBORING_CELLS, Binder.getCallingUid(),
callingPackage) != AppOpsManager.MODE_ALLOWED) {