Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2bc1458 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix include location data to check for coarse location first." into tm-dev am: f8e43432

parents 5bc07863 f8e43432
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -1036,12 +1036,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                callingFeatureId, callback, eventList, notifyNow, subId);
    }

    private void listen(String callingPackage, @Nullable String callingFeatureId,
            IPhoneStateListener callback, Set<Integer> events, boolean notifyNow, int subId) {
        listen(false, false, callingPackage,
                callingFeatureId, callback, events, notifyNow, subId);
    }

    private void listen(boolean renounceFineLocationAccess,
            boolean renounceCoarseLocationAccess, String callingPackage,
            @Nullable String callingFeatureId, IPhoneStateListener callback,
+15 −19
Original line number Diff line number Diff line
@@ -12190,15 +12190,7 @@ public class TelephonyManager {
    })
    @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS)
    public @Nullable ServiceState getServiceState() {
        if (getRenouncedPermissions().contains(Manifest.permission.ACCESS_FINE_LOCATION))  {
            if (getRenouncedPermissions().contains(Manifest.permission.ACCESS_COARSE_LOCATION)) {
                return getServiceState(INCLUDE_LOCATION_DATA_NONE);
            } else {
                return getServiceState(INCLUDE_LOCATION_DATA_COARSE);
            }
        }
        return getServiceState(INCLUDE_LOCATION_DATA_FINE);
        return getServiceState(getLocationData());
    }
    /**
@@ -16189,19 +16181,23 @@ public class TelephonyManager {
     */
    public void registerTelephonyCallback(@NonNull @CallbackExecutor Executor executor,
            @NonNull TelephonyCallback callback) {
        if (getRenouncedPermissions().contains(Manifest.permission.ACCESS_FINE_LOCATION))  {
            if (getRenouncedPermissions().contains(Manifest.permission.ACCESS_COARSE_LOCATION)) {
                registerTelephonyCallback(INCLUDE_LOCATION_DATA_NONE, executor, callback);
                return;
        registerTelephonyCallback(getLocationData(), executor, callback);
    }
    private int getLocationData() {
        boolean renounceCoarseLocation =
                getRenouncedPermissions().contains(Manifest.permission.ACCESS_COARSE_LOCATION);
        boolean renounceFineLocation =
                getRenouncedPermissions().contains(Manifest.permission.ACCESS_FINE_LOCATION);
        if (renounceCoarseLocation) {
            return INCLUDE_LOCATION_DATA_NONE;
        } else if (renounceFineLocation) {
            return INCLUDE_LOCATION_DATA_COARSE;
        } else {
                registerTelephonyCallback(INCLUDE_LOCATION_DATA_COARSE, executor, callback);
                return;
            return INCLUDE_LOCATION_DATA_FINE;
        }
    }
        registerTelephonyCallback(INCLUDE_LOCATION_DATA_FINE, executor, callback);
    }
    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"INCLUDE_LOCATION_DATA_"}, value = {