summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Soonil Nagarkar <sooniln@google.com> 2020-11-23 13:27:22 -0800
committer Soonil Nagarkar <sooniln@google.com> 2020-11-23 14:36:49 -0800
commit00a2b6d443b14fe1a6dfbcc1d0c27e5ea065b696 (patch)
treecec0854e43810ae777c120ccbd191600ef5f4769
parent1681b437d2983a73326818d7bbfb8e3698e4f895 (diff)
Remove LOCATION_GLOBAL_KILL_SWITCH completely
This functionality is no longer needed as all battery saver related logic is handled within location code. Bug: 69373668 Test: presubmits Change-Id: Ie79d6334e0aff5a6562ae0014b9274c81434b977
-rw-r--r--core/api/test-current.txt1
-rw-r--r--core/java/android/provider/Settings.java10
-rw-r--r--packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java1
-rw-r--r--services/core/java/com/android/server/pm/UserRestrictionsUtils.java18
-rw-r--r--services/core/java/com/android/server/power/batterysaver/BatterySaverController.java5
-rw-r--r--services/core/java/com/android/server/power/batterysaver/BatterySaverLocationPlugin.java65
6 files changed, 2 insertions, 98 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 52a79bae6324..ac83aa17f77c 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -1491,7 +1491,6 @@ package android.provider {
field public static final String HIDDEN_API_BLACKLIST_EXEMPTIONS = "hidden_api_blacklist_exemptions";
field public static final String HIDDEN_API_POLICY = "hidden_api_policy";
field public static final String HIDE_ERROR_DIALOGS = "hide_error_dialogs";
- 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";
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 884f8ccd5e54..d8ebb576aaa1 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -13286,16 +13286,6 @@ public final class Settings {
"storage_settings_clobber_threshold";
/**
- * If set to 1, {@link Secure#LOCATION_MODE} will be set to {@link Secure#LOCATION_MODE_OFF}
- * temporarily for all users.
- *
- * @hide
- */
- @TestApi
- public static final String LOCATION_GLOBAL_KILL_SWITCH =
- "location_global_kill_switch";
-
- /**
* If set to 1, SettingsProvider's restoreAnyVersion="true" attribute will be ignored
* and restoring to lower version of platform API will be skipped.
*
diff --git a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
index af12ddd8895b..79933385f7b8 100644
--- a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
+++ b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
@@ -319,7 +319,6 @@ public class SettingsBackupTest {
Settings.Global.LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS,
Settings.Global.LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST,
Settings.Global.LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST,
- Settings.Global.LOCATION_GLOBAL_KILL_SWITCH,
Settings.Global.LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED,
Settings.Global.LOCK_SOUND,
Settings.Global.LOOPER_STATS,
diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
index d0c3a95eafc7..0ac3030ba5dc 100644
--- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
+++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
@@ -34,7 +34,6 @@ import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
-import android.provider.Settings.Global;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.util.Log;
@@ -670,15 +669,6 @@ public class UserRestrictionsUtils {
Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, 0, userId);
}
break;
- case UserManager.DISALLOW_CONFIG_LOCATION:
- // When DISALLOW_CONFIG_LOCATION is set on any user, we undo the global
- // kill switch.
- if (newValue) {
- android.provider.Settings.Global.putString(
- context.getContentResolver(),
- Global.LOCATION_GLOBAL_KILL_SWITCH, "0");
- }
- break;
case UserManager.DISALLOW_APPS_CONTROL:
// Intentional fall-through
case UserManager.DISALLOW_UNINSTALL_APPS:
@@ -774,14 +764,6 @@ public class UserRestrictionsUtils {
restriction = UserManager.DISALLOW_AMBIENT_DISPLAY;
break;
- case android.provider.Settings.Global.LOCATION_GLOBAL_KILL_SWITCH:
- if ("0".equals(value)) {
- return false;
- }
- restriction = UserManager.DISALLOW_CONFIG_LOCATION;
- checkAllUser = true;
- break;
-
case android.provider.Settings.System.SCREEN_BRIGHTNESS:
case android.provider.Settings.System.SCREEN_BRIGHTNESS_FLOAT:
case android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE:
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
index dd287ca6ed00..1e4e0a6a04bc 100644
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
+++ b/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
@@ -224,10 +224,9 @@ public class BatterySaverController implements BatterySaverPolicyListener {
mFileUpdater = new FileUpdater(context);
mBatterySavingStats = batterySavingStats;
+ // TODO(79580230): remove plugin code and maybe screen on/off listeners?
// Initialize plugins.
- mPlugins = new Plugin[] {
- new BatterySaverLocationPlugin(mContext)
- };
+ mPlugins = new Plugin[0];
PowerManager.invalidatePowerSaveModeCaches();
}
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverLocationPlugin.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverLocationPlugin.java
deleted file mode 100644
index a77d133f6c32..000000000000
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverLocationPlugin.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.server.power.batterysaver;
-
-import android.content.Context;
-import android.os.PowerManager;
-import android.provider.Settings;
-import android.provider.Settings.Global;
-import android.util.Slog;
-
-import com.android.server.power.batterysaver.BatterySaverController.Plugin;
-
-public class BatterySaverLocationPlugin implements Plugin {
- private static final String TAG = "BatterySaverLocationPlugin";
-
- private static final boolean DEBUG = BatterySaverController.DEBUG;
-
- private final Context mContext;
-
- public BatterySaverLocationPlugin(Context context) {
- mContext = context;
- }
-
- @Override
- public void onBatterySaverChanged(BatterySaverController caller) {
- if (DEBUG) {
- Slog.d(TAG, "onBatterySaverChanged");
- }
- updateLocationState(caller);
- }
-
- @Override
- public void onSystemReady(BatterySaverController caller) {
- if (DEBUG) {
- Slog.d(TAG, "onSystemReady");
- }
- updateLocationState(caller);
- }
-
- private void updateLocationState(BatterySaverController caller) {
- final boolean kill =
- (caller.getBatterySaverPolicy().getGpsMode()
- == PowerManager.LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF)
- && !caller.isInteractive();
-
- if (DEBUG) {
- Slog.d(TAG, "Battery saver " + (kill ? "stopping" : "restoring") + " location.");
- }
- Settings.Global.putInt(mContext.getContentResolver(),
- Global.LOCATION_GLOBAL_KILL_SWITCH, kill ? 1 : 0);
- }
-}