diff --git a/AndroidManifest.xml b/AndroidManifest.xml index aa98c62f49d..efa57ded87d 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1161,7 +1161,7 @@ @@ -1180,7 +1180,7 @@ diff --git a/color-check-baseline.xml b/color-check-baseline.xml index 62c7915a3d3..d28f2d131ec 100644 --- a/color-check-baseline.xml +++ b/color-check-baseline.xml @@ -1213,6 +1213,22 @@ column="5"/> + + + + @@ -1241,7 +1257,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1257,7 +1273,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1273,7 +1289,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1289,7 +1305,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1305,7 +1321,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1321,7 +1337,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1337,7 +1353,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1353,7 +1369,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1369,7 +1385,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1385,7 +1401,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1853,6 +1869,38 @@ column="17"/> + + + + + + + + + + + + + + + + + + + + + diff --git a/res/drawable/ic_preference_location.xml b/res/drawable/ic_preference_location.xml new file mode 100644 index 00000000000..e37d629d404 --- /dev/null +++ b/res/drawable/ic_preference_location.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + diff --git a/res/drawable/ic_settings_location.xml b/res/drawable/ic_settings_location.xml index 34bd4f098b7..b7cfd6f2386 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"> diff --git a/res/values/colors.xml b/res/values/colors.xml index f398d9225ce..a00fd8a8b1f 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -125,6 +125,7 @@ #757575 #26459C #1A73E8 + #2EC7DC @*android:color/material_red_A700 diff --git a/res/values/dimens.xml b/res/values/dimens.xml index e163f7fe00a..18bcc38a162 100755 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -88,6 +88,9 @@ 6dp + + 12dp + 72dp 16dp diff --git a/res/values/strings.xml b/res/values/strings.xml index 84a807c3b0f..e828ac2b677 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -814,11 +814,13 @@ Location Use location + + Scanning, location history Accounts - Security & location + Security Encryption & credentials @@ -8943,12 +8945,6 @@ %1$s is default - - On - - - Off - Back up disabled diff --git a/res/xml/security_dashboard_settings.xml b/res/xml/security_dashboard_settings.xml index e543ad92406..ce271cc4752 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"> - - @@ -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"/> @@ -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"/> + + buildPreferenceControllers(Context context, Lifecycle lifecycle, SecuritySettings host) { final List 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 a4e0cff5c3a..5f899ebe8f5 100644 --- a/src/com/android/settings/users/AppRestrictionsFragment.java +++ b/src/com/android/settings/users/AppRestrictionsFragment.java @@ -450,7 +450,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen 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 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 c12fdc90f7d..00000000000 --- 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()); - } -}