Check SDK Version For NeighborCellInfo
Callers on P-or-earlier will receive NeighborCellInfo.
Callers with a newer SDK will simply receive NULL.
This is being done as part of removing support for
this API in favor of getAllCellInfo.
Bug: 62490173
Test: manually tested using SL4A (P and P+ SDK)
Change-Id: Id4919e7fe580655b8fb626961be020b7171ba51b
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index dc8b5bf..5d2eee7 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1928,9 +1928,11 @@
@Override
@SuppressWarnings("unchecked")
- public List<NeighboringCellInfo> getNeighboringCellInfo(String callingPackage) {
- mPhone.getContext().getSystemService(AppOpsManager.class)
- .checkPackage(Binder.getCallingUid(), callingPackage);
+ public List<NeighboringCellInfo>
+ getNeighboringCellInfo(String callingPackage, int targetSdk) {
+ // FIXME: use the P constant when available
+ if (targetSdk > android.os.Build.VERSION_CODES.O_MR1 + 1) return null;
+
if (!LocationAccessPolicy.canAccessCellLocation(mPhone.getContext(),
callingPackage, Binder.getCallingUid(), Binder.getCallingPid())) {
return null;