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

Commit baae82a8 authored by David Christie's avatar David Christie Committed by Android (Google) Code Review
Browse files

Merge "Don't track LocationManager internal requests in AppOps (b/10725757)....

Merge "Don't track LocationManager internal requests in AppOps (b/10725757). AppOps stats are used to populate the "apps recently using location" list in settings->location.  There is no reason to show Android OS in that list simply because of internal location requests supporting other clients." into klp-dev
parents b481dae2 9e9ce925
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.location.FusedBatchOptions;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.location.LocationRequest;

import android.content.Context;
import android.os.Bundle;
@@ -73,10 +74,19 @@ public class FlpHardwareProvider {
        // register for listening for passive provider data
        LocationManager manager = (LocationManager) mContext.getSystemService(
                Context.LOCATION_SERVICE);
        manager.requestLocationUpdates(
        final long minTime = 0;
        final float minDistance = 0;
        final boolean oneShot = false;
        LocationRequest request = LocationRequest.createFromDeprecatedProvider(
                LocationManager.PASSIVE_PROVIDER,
                0 /* minTime */,
                0 /* minDistance */,
                minTime,
                minDistance,
                oneShot);
        // Don't keep track of this request since it's done on behalf of other clients
        // (which are kept track of separately).
        request.setHideFromAppOps(true);
        manager.requestLocationUpdates(
                request,
                new NetworkLocationListener(),
                Looper.myLooper());
    }
+15 −2
Original line number Diff line number Diff line
@@ -512,8 +512,21 @@ public class GpsLocationProvider implements LocationProviderInterface {
            public void run() {
                LocationManager locManager =
                        (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
                locManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER,
                        0, 0, new NetworkLocationListener(), mHandler.getLooper());
                final long minTime = 0;
                final float minDistance = 0;
                final boolean oneShot = false;
                LocationRequest request = LocationRequest.createFromDeprecatedProvider(
                        LocationManager.PASSIVE_PROVIDER,
                        minTime,
                        minDistance,
                        oneShot);
                // Don't keep track of this request since it's done on behalf of other clients
                // (which are kept track of separately).
                request.setHideFromAppOps(true);
                locManager.requestLocationUpdates(
                        request,
                        new NetworkLocationListener(),
                        mHandler.getLooper());
            }
        });
    }