From 757380517baed7274a55a2fa4ef7bfe1cc774fc1 Mon Sep 17 00:00:00 2001 From: Soonil Nagarkar Date: Wed, 26 Aug 2020 19:08:21 -0700 Subject: Make LocationRequest a public API LocationRequest and associated APIs have historically always been SystemApi, for no real reason. In keeping with the Android-wide push to clean up API surfaces like this, we make LocationRequest a public API. Bug: 166692379 Test: manual + presubmits Change-Id: I6a93fca1a5613c96bf35da158bc542e47864dbff --- .../com/android/printspooler/ui/FusedPrintersProvider.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'packages/PrintSpooler/src') diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java b/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java index 467a60e62e14..8e140ca27971 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java @@ -31,6 +31,7 @@ import android.location.LocationRequest; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; +import android.os.HandlerExecutor; import android.os.Looper; import android.os.SystemClock; import android.print.PrintManager; @@ -250,9 +251,13 @@ public final class FusedPrintersProvider extends Loader> Log.i(LOG_TAG, "onStartLoading() " + FusedPrintersProvider.this.hashCode()); } - mLocationManager.requestLocationUpdates(LocationRequest.create() - .setQuality(LocationRequest.POWER_LOW).setInterval(LOCATION_UPDATE_MS), this, - Looper.getMainLooper()); + mLocationManager.requestLocationUpdates( + LocationManager.FUSED_PROVIDER, + new LocationRequest.Builder(LOCATION_UPDATE_MS) + .setQuality(LocationRequest.POWER_LOW) + .build(), + new HandlerExecutor(new Handler(Looper.getMainLooper())), + this); Location lastLocation = mLocationManager.getLastLocation(); if (lastLocation != null) { -- cgit v1.2.3-59-g8ed1b