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

Commit f6410681 authored by Kweku Adams's avatar Kweku Adams Committed by Android (Google) Code Review
Browse files

Merge "Adding new Battery Saver location mode."

parents 726e36e8 4fb074e7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -35128,6 +35128,7 @@ package android.os {
    field public static final int LOCATION_MODE_FOREGROUND_ONLY = 3; // 0x3
    field public static final int LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF = 1; // 0x1
    field public static final int LOCATION_MODE_NO_CHANGE = 0; // 0x0
    field public static final int LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF = 4; // 0x4
    field public static final int ON_AFTER_RELEASE = 536870912; // 0x20000000
    field public static final int PARTIAL_WAKE_LOCK = 1; // 0x1
    field public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; // 0x20
+5 −0
Original line number Diff line number Diff line
@@ -905,6 +905,7 @@ package android.location {
  public class LocationManager {
    method public String[] getBackgroundThrottlingWhitelist();
    method public String[] getIgnoreSettingsWhitelist();
    method @NonNull public java.util.List<android.location.LocationRequest> getTestProviderCurrentRequests(String);
    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(android.location.LocationRequest, android.location.LocationListener, android.os.Looper);
    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(android.location.LocationRequest, android.app.PendingIntent);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean, android.os.UserHandle);
@@ -918,11 +919,14 @@ package android.location {
    method public long getInterval();
    method public int getNumUpdates();
    method public int getQuality();
    method public boolean isLocationSettingsIgnored();
    method public android.location.LocationRequest setExpireAt(long);
    method public android.location.LocationRequest setExpireIn(long);
    method public android.location.LocationRequest setFastestInterval(long);
    method public android.location.LocationRequest setInterval(long);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public android.location.LocationRequest setLocationSettingsIgnored(boolean);
    method public android.location.LocationRequest setNumUpdates(int);
    method public android.location.LocationRequest setProvider(String);
    method public android.location.LocationRequest setQuality(int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ACCURACY_BLOCK = 102; // 0x66
@@ -2000,6 +2004,7 @@ package android.provider {
    field public static final String DYNAMIC_POWER_SAVINGS_ENABLED = "dynamic_power_savings_enabled";
    field public static final String HIDDEN_API_BLACKLIST_EXEMPTIONS = "hidden_api_blacklist_exemptions";
    field public static final String LOCATION_GLOBAL_KILL_SWITCH = "location_global_kill_switch";
    field public static final String LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST = "location_ignore_settings_package_whitelist";
    field public static final String LOW_POWER_MODE = "low_power";
    field public static final String LOW_POWER_MODE_STICKY = "low_power_sticky";
    field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
+26 −1
Original line number Diff line number Diff line
@@ -764,8 +764,14 @@ public final class PowerManager {
     */
    public static final int LOCATION_MODE_FOREGROUND_ONLY = 3;

    /**
     * In this mode, location will not be turned off, but LocationManager will throttle all
     * requests to providers when the device is non-interactive.
     */
    public static final int LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF = 4;

    static final int MIN_LOCATION_MODE = LOCATION_MODE_NO_CHANGE;
    static final int MAX_LOCATION_MODE = LOCATION_MODE_FOREGROUND_ONLY;
    static final int MAX_LOCATION_MODE = LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF;

    /**
     * @hide
@@ -776,9 +782,28 @@ public final class PowerManager {
            LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF,
            LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF,
            LOCATION_MODE_FOREGROUND_ONLY,
            LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF,
    })
    public @interface LocationPowerSaveMode {}

    /** @hide */
    public static String locationPowerSaveModeToString(@LocationPowerSaveMode int mode) {
        switch (mode) {
            case LOCATION_MODE_NO_CHANGE:
                return "NO_CHANGE";
            case LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF:
                return "GPS_DISABLED_WHEN_SCREEN_OFF";
            case LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF:
                return "ALL_DISABLED_WHEN_SCREEN_OFF";
            case LOCATION_MODE_FOREGROUND_ONLY:
                return "FOREGROUND_ONLY";
            case LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF:
                return "THROTTLE_REQUESTS_WHEN_SCREEN_OFF";
            default:
                return Integer.toString(mode);
        }
    }

    final Context mContext;
    final IPowerManager mService;
    final Handler mHandler;
+1 −0
Original line number Diff line number Diff line
@@ -9635,6 +9635,7 @@ public final class Settings {
         * when user location settings are off), for emergency purposes.
         * @hide
         */
        @TestApi
        public static final String LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST =
                "location_ignore_settings_package_whitelist";
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ interface ILocationManager
    void removeTestProvider(String provider, String opPackageName);
    void setTestProviderLocation(String provider, in Location loc, String opPackageName);
    void setTestProviderEnabled(String provider, boolean enabled, String opPackageName);
    List<LocationRequest> getTestProviderCurrentRequests(String provider, String opPackageName);

    // --- deprecated ---
    void setTestProviderStatus(String provider, int status, in Bundle extras, long updateTime,
Loading