Move LocationSettings to top level page.
- Create some location icons for different scenario.
- Remove Location in Security page.
- Move Location Setting to top level page.
Test: robotest, visual
Bug: 116628158
Change-Id: I3f57ef49a396877bfbeaefea7dc4f4051e0ccc65
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index aa98c62..efa57de 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1161,7 +1161,7 @@
<activity
android:name="Settings$LocationSettingsActivity"
android:label="@string/location_settings_title"
- android:icon="@drawable/ic_settings_location"
+ android:icon="@drawable/ic_homepage_location"
android:configChanges="orientation|keyboardHidden|screenSize"
android:parentActivityName="Settings">
<intent-filter android:priority="1">
@@ -1180,7 +1180,7 @@
<activity
android:name="Settings$ScanningSettingsActivity"
android:label="@string/location_scanning_screen_title"
- android:icon="@drawable/ic_settings_location"
+ android:icon="@drawable/ic_homepage_location"
android:configChanges="orientation|keyboardHidden|screenSize"
android:parentActivityName="Settings">
<intent-filter android:priority="1">
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 62c7915..d28f2d1 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -1221,11 +1221,27 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="homepage_location_background">#1A73E8</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="128"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" <color name="battery_good_color_light">#43a047</color> <!-- Material Green 600 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="132"
+ line="133"
column="5"/>
</issue>
@@ -1241,7 +1257,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="133"
+ line="134"
column="5"/>
</issue>
@@ -1257,7 +1273,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="134"
+ line="135"
column="5"/>
</issue>
@@ -1273,7 +1289,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="135"
+ line="136"
column="5"/>
</issue>
@@ -1289,7 +1305,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="136"
+ line="137"
column="5"/>
</issue>
@@ -1305,7 +1321,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="137"
+ line="138"
column="5"/>
</issue>
@@ -1321,7 +1337,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="140"
+ line="141"
column="5"/>
</issue>
@@ -1337,7 +1353,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="141"
+ line="142"
column="5"/>
</issue>
@@ -1353,7 +1369,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="142"
+ line="143"
column="5"/>
</issue>
@@ -1369,7 +1385,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="143"
+ line="144"
column="5"/>
</issue>
@@ -1385,7 +1401,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="144"
+ line="145"
column="5"/>
</issue>
@@ -1861,6 +1877,38 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" android:color="@color/homepage_location_background" />"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_homepage_location.xml"
+ line="23"
+ column="17"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" android:color="@color/homepage_location_background" />"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_preference_location.xml"
+ line="23"
+ column="17"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color="@color/homepage_support_background" />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
diff --git a/res/drawable/ic_homepage_location.xml b/res/drawable/ic_homepage_location.xml
new file mode 100644
index 0000000..413801b
--- /dev/null
+++ b/res/drawable/ic_homepage_location.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 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.
+ -->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item>
+ <shape android:shape="oval">
+ <solid
+ android:color="@color/homepage_location_background"/>
+ <size
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"/>
+ </shape>
+ </item>
+
+ <item
+ android:width="@dimen/dashboard_tile_foreground_image_size"
+ android:height="@dimen/dashboard_tile_foreground_image_size"
+ android:start="@dimen/dashboard_tile_foreground_image_inset"
+ android:top="@dimen/dashboard_tile_foreground_image_inset"
+ android:drawable="@drawable/ic_settings_location"/>
+</layer-list>
diff --git a/res/drawable/ic_preference_location.xml b/res/drawable/ic_preference_location.xml
new file mode 100644
index 0000000..e37d629
--- /dev/null
+++ b/res/drawable/ic_preference_location.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 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.
+ -->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item>
+ <shape android:shape="oval">
+ <solid
+ android:color="@color/homepage_location_background"/>
+ <size
+ android:width="@android:dimen/app_icon_size"
+ android:height="@android:dimen/app_icon_size"/>
+ </shape>
+ </item>
+
+ <item
+ android:width="@dimen/dashboard_tile_foreground_image_size"
+ android:height="@dimen/dashboard_tile_foreground_image_size"
+ android:start="@dimen/preference_icon_foreground_image_inset"
+ android:top="@dimen/preference_icon_foreground_image_inset"
+ android:drawable="@drawable/ic_settings_location"/>
+</layer-list>
diff --git a/res/drawable/ic_settings_location.xml b/res/drawable/ic_settings_location.xml
index 34bd4f0..b7cfd6f 100644
--- a/res/drawable/ic_settings_location.xml
+++ b/res/drawable/ic_settings_location.xml
@@ -17,8 +17,7 @@
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
+ android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13C19,5.13 15.87,2 12,2zM7,9c0,-2.76 2.24,-5 5,-5s5,2.24 5,5c0,2.88 -2.88,7.19 -5,9.88C9.92,16.21 7,11.85 7,9z"/>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index f398d92..a00fd8a 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -125,6 +125,7 @@
<color name="homepage_system_background">#757575</color>
<color name="homepage_support_background">#26459C</color>
<color name="homepage_generic_icon_background">#1A73E8</color>
+ <color name="homepage_location_background">#2EC7DC</color>
<!-- End of dashboard/homepage icon background colors -->
<color name="glif_error_color">@*android:color/material_red_A700</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 9b33388..1b07580 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -88,6 +88,9 @@
<!-- Dashboard foreground image inset (from background edge to foreground edge) -->
<dimen name="dashboard_tile_foreground_image_inset">6dp</dimen>
+ <!-- Preference icon foreground image inset (from background edge to foreground edge) -->
+ <dimen name="preference_icon_foreground_image_inset">12dp</dimen>
+
<!-- SwitchBar sub settings margin start / end -->
<dimen name="switchbar_subsettings_margin_start">72dp</dimen>
<dimen name="switchbar_subsettings_margin_end">16dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4a2443a..9650089 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -814,6 +814,8 @@
<string name="location_settings_title">Location</string>
<!-- Used in the location settings to control turning on/off the feature entirely -->
<string name="location_settings_master_switch_title">Use location</string>
+ <!-- Summary for Location settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
+ <string name="location_settings_summary">Scanning, location history</string>
<!-- Main Settings screen setting option title for the item to take you to the accounts screen [CHAR LIMIT=22] -->
<string name="account_settings_title">Accounts</string>
@@ -8943,12 +8945,6 @@
<!-- Summary of payment screen [CHAR LIMIT=NONE] -->
<string name="payment_summary"><xliff:g id="app_name" example="Payment App">%1$s</xliff:g> is default</string>
- <!-- Summary of location on screen [CHAR LIMIT=NONE] -->
- <string name="location_on_summary">On</string>
-
- <!-- Location off [CHAR LIMIT=NONE] -->
- <string name="location_off_summary">Off</string>
-
<!-- Backup disabled summary [CHAR LIMIT=NONE] -->
<string name="backup_disabled">Back up disabled</string>
diff --git a/res/xml/security_dashboard_settings.xml b/res/xml/security_dashboard_settings.xml
index e543ad9..ce271cc 100644
--- a/res/xml/security_dashboard_settings.xml
+++ b/res/xml/security_dashboard_settings.xml
@@ -95,12 +95,6 @@
android:key="security_settings_misc_category"
android:title="@string/security_passwords_title">
- <Preference
- android:key="location"
- android:title="@string/location_settings_title"
- android:summary="@string/summary_placeholder"
- android:fragment="com.android.settings.location.LocationSettings" />
-
<SwitchPreference
android:key="show_password"
android:title="@string/show_password"
diff --git a/res/xml/top_level_settings.xml b/res/xml/top_level_settings.xml
index e11d84a..b5930e4 100644
--- a/res/xml/top_level_settings.xml
+++ b/res/xml/top_level_settings.xml
@@ -26,7 +26,7 @@
android:title="@string/network_dashboard_title"
android:summary="@string/summary_placeholder"
android:icon="@drawable/ic_homepage_network"
- android:order="-110"
+ android:order="-120"
android:fragment="com.android.settings.network.NetworkDashboardFragment"
settings:controller="com.android.settings.network.TopLevelNetworkEntryPreferenceController"/>
@@ -35,7 +35,7 @@
android:title="@string/connected_devices_dashboard_title"
android:summary="@string/summary_placeholder"
android:icon="@drawable/ic_homepage_connected_device"
- android:order="-100"
+ android:order="-110"
android:fragment="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment"
settings:controller="com.android.settings.connecteddevice.TopLevelConnectedDevicesPreferenceController"/>
@@ -44,7 +44,7 @@
android:title="@string/app_and_notification_dashboard_title"
android:summary="@string/app_and_notification_dashboard_summary"
android:icon="@drawable/ic_homepage_apps"
- android:order="-90"
+ android:order="-100"
android:fragment="com.android.settings.applications.AppAndNotificationDashboardFragment"/>
<Preference
@@ -53,7 +53,7 @@
android:summary="@string/summary_placeholder"
android:icon="@drawable/ic_homepage_battery"
android:fragment="com.android.settings.fuelgauge.PowerUsageSummary"
- android:order="-80"
+ android:order="-90"
settings:controller="com.android.settings.fuelgauge.TopLevelBatteryPreferenceController"/>
<Preference
@@ -61,7 +61,7 @@
android:title="@string/display_settings"
android:summary="@string/summary_placeholder"
android:icon="@drawable/ic_homepage_display"
- android:order="-70"
+ android:order="-80"
android:fragment="com.android.settings.DisplaySettings"
settings:controller="com.android.settings.display.TopLevelDisplayPreferenceController"/>
@@ -70,7 +70,7 @@
android:title="@string/sound_settings"
android:summary="@string/sound_dashboard_summary"
android:icon="@drawable/ic_homepage_sound"
- android:order="-60"
+ android:order="-70"
android:fragment="com.android.settings.notification.SoundSettings"/>
<Preference
@@ -78,11 +78,19 @@
android:title="@string/storage_settings"
android:summary="@string/summary_placeholder"
android:icon="@drawable/ic_homepage_storage"
- android:order="-50"
+ android:order="-60"
android:fragment="com.android.settings.deviceinfo.StorageSettings"
settings:controller="com.android.settings.deviceinfo.TopLevelStoragePreferenceController"/>
<Preference
+ android:key="top_level_location"
+ android:title="@string/location_settings_title"
+ android:summary="@string/location_settings_summary"
+ android:icon="@drawable/ic_homepage_location"
+ android:order="-50"
+ android:fragment="com.android.settings.location.LocationSettings"/>
+
+ <Preference
android:key="top_level_security"
android:title="@string/security_settings_title"
android:summary="@string/summary_placeholder"
diff --git a/src/com/android/settings/location/LocationPreferenceController.java b/src/com/android/settings/location/LocationPreferenceController.java
deleted file mode 100644
index 0efc2b1..0000000
--- a/src/com/android/settings/location/LocationPreferenceController.java
+++ /dev/null
@@ -1,111 +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.settings.location;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.location.LocationManager;
-import android.provider.Settings.Secure;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnPause;
-import com.android.settingslib.core.lifecycle.events.OnResume;
-
-public class LocationPreferenceController extends AbstractPreferenceController
- implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
-
- private static final String KEY_LOCATION = "location";
- private Context mContext;
- private Preference mPreference;
-
- @VisibleForTesting
- BroadcastReceiver mLocationProvidersChangedReceiver;
-
- public LocationPreferenceController(Context context, Lifecycle lifecycle) {
- super(context);
- mContext = context;
- mLocationProvidersChangedReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent.getAction().equals(LocationManager.PROVIDERS_CHANGED_ACTION)) {
- updateSummary();
- }
- }
- };
- if (lifecycle != null) {
- lifecycle.addObserver(this);
- }
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
- mPreference = screen.findPreference(KEY_LOCATION);
- }
-
- @Override
- public void onResume() {
- if (mLocationProvidersChangedReceiver != null) {
- mContext.registerReceiver(mLocationProvidersChangedReceiver, new IntentFilter(
- LocationManager.PROVIDERS_CHANGED_ACTION));
- }
- }
-
- @Override
- public void onPause() {
- if (mLocationProvidersChangedReceiver != null) {
- mContext.unregisterReceiver(mLocationProvidersChangedReceiver);
- }
- }
-
- @Override
- public void updateState(Preference preference) {
- preference.setSummary(getLocationSummary(mContext));
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_LOCATION;
- }
-
- @Override
- public boolean isAvailable() {
- return true;
- }
-
- public void updateSummary() {
- updateState(mPreference);
- }
-
- public static String getLocationSummary(Context context) {
- int mode = Secure.getInt(context.getContentResolver(),
- Secure.LOCATION_MODE, Secure.LOCATION_MODE_OFF);
- if (mode != Secure.LOCATION_MODE_OFF) {
- return context.getString(R.string.location_on_summary);
- }
- return context.getString(R.string.location_off_summary);
- }
-}
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index 758ca57..53076e8 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -133,34 +133,6 @@
return controllers;
}
- private static class SummaryProvider implements SummaryLoader.SummaryProvider {
-
- private final Context mContext;
- private final SummaryLoader mSummaryLoader;
-
- public SummaryProvider(Context context, SummaryLoader summaryLoader) {
- mContext = context;
- mSummaryLoader = summaryLoader;
- }
-
- @Override
- public void setListening(boolean listening) {
- if (listening) {
- mSummaryLoader.setSummary(
- this, LocationPreferenceController.getLocationSummary(mContext));
- }
- }
- }
-
- public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
- = new SummaryLoader.SummaryProviderFactory() {
- @Override
- public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
- SummaryLoader summaryLoader) {
- return new SummaryProvider(activity, summaryLoader);
- }
- };
-
/**
* For Search.
*/
diff --git a/src/com/android/settings/security/SecuritySettings.java b/src/com/android/settings/security/SecuritySettings.java
index eb0d6f1..e00d387 100644
--- a/src/com/android/settings/security/SecuritySettings.java
+++ b/src/com/android/settings/security/SecuritySettings.java
@@ -29,7 +29,6 @@
import com.android.settings.biometrics.fingerprint.FingerprintStatusPreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.enterprise.EnterprisePrivacyPreferenceController;
-import com.android.settings.location.LocationPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.security.trustagent.ManageTrustAgentsPreferenceController;
import com.android.settings.security.trustagent.TrustAgentListPreferenceController;
@@ -105,7 +104,6 @@
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle, SecuritySettings host) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
- controllers.add(new LocationPreferenceController(context, lifecycle));
controllers.add(new EnterprisePrivacyPreferenceController(context));
controllers.add(new ManageTrustAgentsPreferenceController(context));
controllers.add(new ScreenPinningPreferenceController(context));
diff --git a/src/com/android/settings/users/AppRestrictionsFragment.java b/src/com/android/settings/users/AppRestrictionsFragment.java
index a4e0cff..5f899eb 100644
--- a/src/com/android/settings/users/AppRestrictionsFragment.java
+++ b/src/com/android/settings/users/AppRestrictionsFragment.java
@@ -450,7 +450,7 @@
private void addLocationAppRestrictionsPreference(AppRestrictionsHelper.SelectableAppInfo app,
AppRestrictionsPreference p) {
String packageName = app.packageName;
- p.setIcon(R.drawable.ic_settings_location);
+ p.setIcon(R.drawable.ic_preference_location);
p.setKey(getKeyForPackage(packageName));
ArrayList<RestrictionEntry> restrictions = RestrictionUtils.getRestrictions(
getActivity(), mUser);
diff --git a/tests/robotests/src/com/android/settings/location/LocationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/LocationPreferenceControllerTest.java
deleted file mode 100644
index c12fdc9..0000000
--- a/tests/robotests/src/com/android/settings/location/LocationPreferenceControllerTest.java
+++ /dev/null
@@ -1,153 +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.settings.location;
-
-import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
-import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.nullable;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.location.LocationManager;
-import android.provider.Settings.Secure;
-
-import androidx.lifecycle.LifecycleOwner;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-public class LocationPreferenceControllerTest {
- @Mock
- private Preference mPreference;
- @Mock
- private PreferenceScreen mScreen;
-
- private LifecycleOwner mLifecycleOwner;
- private Lifecycle mLifecycle;
- private LocationPreferenceController mController;
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private Context mContext;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mLifecycleOwner = () -> mLifecycle;
- mLifecycle = new Lifecycle(mLifecycleOwner);
- mController = new LocationPreferenceController(mContext, mLifecycle);
- when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
- }
-
- @Test
- public void isAvailable_shouldReturnTrue() {
- assertThat(mController.isAvailable()).isTrue();
- }
-
- @Test
- public void updateState_shouldSetSummary() {
- mController.updateState(mPreference);
-
- verify(mPreference).setSummary(nullable(String.class));
- }
-
- @Test
- public void updateSummary_shouldSetSummary() {
- mController.displayPreference(mScreen);
- mController.updateSummary();
-
- verify(mPreference).setSummary(nullable(String.class));
- }
-
- @Test
- public void getLocationSummary_locationOff_shouldSetSummaryOff() {
- final ContentResolver contentResolver = mContext.getContentResolver();
- Secure.putInt(contentResolver, Secure.LOCATION_MODE, Secure.LOCATION_MODE_OFF);
-
- final String locationSummary = mController.getLocationSummary(mContext);
- assertThat(locationSummary).isEqualTo(mContext.getString(R.string.location_off_summary));
- }
-
- @Test
- public void getLocationSummary_sensorsOnly_shouldSetSummaryOn() {
- final ContentResolver contentResolver = mContext.getContentResolver();
- Secure.putInt(contentResolver, Secure.LOCATION_MODE, Secure.LOCATION_MODE_SENSORS_ONLY);
-
- final String locationSummary = mController.getLocationSummary(mContext);
- assertThat(locationSummary).isEqualTo(mContext.getString(R.string.location_on_summary));
- }
-
- @Test
- public void getLocationSummary_highAccuracy_shouldSetSummaryOn() {
- final ContentResolver contentResolver = mContext.getContentResolver();
- Secure.putInt(contentResolver, Secure.LOCATION_MODE, Secure.LOCATION_MODE_HIGH_ACCURACY);
-
- final String locationSummary = mController.getLocationSummary(mContext);
- assertThat(locationSummary).isEqualTo(mContext.getString(R.string.location_on_summary));
- }
-
- @Test
- public void getLocationSummary_batterySaving_shouldSetSummaryOn() {
- final ContentResolver contentResolver = mContext.getContentResolver();
- Secure.putInt(contentResolver, Secure.LOCATION_MODE, Secure.LOCATION_MODE_BATTERY_SAVING);
-
- final String locationSummary = mController.getLocationSummary(mContext);
- assertThat(locationSummary).isEqualTo(mContext.getString(R.string.location_on_summary));
- }
-
- @Test
- public void onResume_shouldRegisterObserver() {
- mLifecycle.handleLifecycleEvent(ON_RESUME);
- verify(mContext).registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class));
- }
-
- @Test
- public void onPause_shouldUnregisterObserver() {
- mLifecycle.handleLifecycleEvent(ON_RESUME);
- mLifecycle.handleLifecycleEvent(ON_PAUSE);
- verify(mContext).unregisterReceiver(any(BroadcastReceiver.class));
- }
-
- @Test
- public void locationProvidersChangedReceiver_updatesPreferenceSummary() {
- mController.displayPreference(mScreen);
- mController.onResume();
-
- mController.mLocationProvidersChangedReceiver
- .onReceive(mContext, new Intent(LocationManager.PROVIDERS_CHANGED_ACTION));
-
- verify(mPreference).setSummary(any());
- }
-}