requestCellInfoUpdate: always check location perms
Check for fine location permission on all api levels -- this api is new
to api level 29, so older apps won't be tripped up by it.
Fixes: 154934934
Test: atest TelephonyLocationTest
Change-Id: Ia4edcf9ac5b5e3c4c2a3bfb79abb31242484f14f
(cherry picked from commit d60acc9f3247eaa64626d2c119114e31f47b30c1)
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index b0f8c5f..34381f7 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -106,6 +106,7 @@
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.text.TextUtils;
import android.util.ArraySet;
+import android.util.EventLog;
import android.util.Log;
import android.util.Pair;
import android.util.Slog;
@@ -2136,12 +2137,21 @@
.setCallingPid(Binder.getCallingPid())
.setCallingUid(Binder.getCallingUid())
.setMethod("requestCellInfoUpdate")
- .setMinSdkVersionForFine(Build.VERSION_CODES.Q)
+ .setMinSdkVersionForCoarse(Build.VERSION_CODES.BASE)
+ .setMinSdkVersionForFine(Build.VERSION_CODES.BASE)
.build());
switch (locationResult) {
case DENIED_HARD:
+ if (getTargetSdk(callingPackage) < Build.VERSION_CODES.Q) {
+ // Safetynet logging for b/154934934
+ EventLog.writeEvent(0x534e4554, "154934934", Binder.getCallingUid());
+ }
throw new SecurityException("Not allowed to access cell info");
case DENIED_SOFT:
+ if (getTargetSdk(callingPackage) < Build.VERSION_CODES.Q) {
+ // Safetynet logging for b/154934934
+ EventLog.writeEvent(0x534e4554, "154934934", Binder.getCallingUid());
+ }
try {
cb.onCellInfo(new ArrayList<CellInfo>());
} catch (RemoteException re) {