From 80d03d1d2047c47abdf2f0dc7edc86ac8dbfa1c8 Mon Sep 17 00:00:00 2001 From: tmfang Date: Fri, 2 Nov 2018 16:53:47 +0800 Subject: [PATCH] Create a new top level Privacy entry This CL focuses on building up Privacy entry in Settings homepage. And also reuse some preferences in here. -App permission -Show password Test: robotest, visual Change-Id: I724ba4b4845fac933df0fca23a4e1c6afeb73362 Fixes: 116628158 --- color-check-baseline.xml | 54 +++++++++++--- res/drawable/ic_homepage_privacy.xml | 36 ++++++++++ res/drawable/ic_settings_privacy.xml | 31 ++++++++ res/values/colors.xml | 1 + res/values/strings.xml | 8 +++ res/xml/privacy_dashboard_settings.xml | 45 ++++++++++++ res/xml/top_level_settings.xml | 8 +++ .../core/gateway/SettingsGateway.java | 2 + .../dashboard/DashboardFragmentRegistry.java | 3 + .../privacy/PrivacyDashboardFragment.java | 70 +++++++++++++++++++ 10 files changed, 247 insertions(+), 11 deletions(-) create mode 100644 res/drawable/ic_homepage_privacy.xml create mode 100644 res/drawable/ic_settings_privacy.xml create mode 100644 res/xml/privacy_dashboard_settings.xml create mode 100644 src/com/android/settings/privacy/PrivacyDashboardFragment.java diff --git a/color-check-baseline.xml b/color-check-baseline.xml index 3672e2d7a84..365cbe71abd 100644 --- a/color-check-baseline.xml +++ b/color-check-baseline.xml @@ -1245,6 +1245,22 @@ column="5"/> + + + + @@ -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=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1401,7 +1417,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1417,7 +1433,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1901,6 +1917,22 @@ column="17"/> + + + + + + + + + + + + + + + + + diff --git a/res/drawable/ic_settings_privacy.xml b/res/drawable/ic_settings_privacy.xml new file mode 100644 index 00000000000..fcad83ab33b --- /dev/null +++ b/res/drawable/ic_settings_privacy.xml @@ -0,0 +1,31 @@ + + + + + + + diff --git a/res/values/colors.xml b/res/values/colors.xml index 11c1aaf4437..f55eb1a7813 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -127,6 +127,7 @@ #1A73E8 #2EC7DC #9FA8DA + #5E97F6 @*android:color/material_red_A700 diff --git a/res/values/strings.xml b/res/values/strings.xml index f30c63d2f80..9e5cb2ade08 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -6658,6 +6658,8 @@ + + @@ -10278,4 +10280,10 @@ Force desktop mode Force experimental desktop mode on secondary displays + + + Privacy + + Permission, permission usage + diff --git a/res/xml/privacy_dashboard_settings.xml b/res/xml/privacy_dashboard_settings.xml new file mode 100644 index 00000000000..5d11936bf9f --- /dev/null +++ b/res/xml/privacy_dashboard_settings.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/xml/top_level_settings.xml b/res/xml/top_level_settings.xml index 69c4bb83cd2..03e32dcfb27 100644 --- a/res/xml/top_level_settings.xml +++ b/res/xml/top_level_settings.xml @@ -82,6 +82,14 @@ android:fragment="com.android.settings.deviceinfo.StorageSettings" settings:controller="com.android.settings.deviceinfo.TopLevelStoragePreferenceController"/> + + (PARENT_TO_CATEGORY_KEY_MAP.size()); diff --git a/src/com/android/settings/privacy/PrivacyDashboardFragment.java b/src/com/android/settings/privacy/PrivacyDashboardFragment.java new file mode 100644 index 00000000000..e3cd45768f6 --- /dev/null +++ b/src/com/android/settings/privacy/PrivacyDashboardFragment.java @@ -0,0 +1,70 @@ +/* + * 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. + */ + +package com.android.settings.privacy; + +import android.content.Context; +import android.provider.SearchIndexableResource; + +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; +import com.android.settings.R; +import com.android.settings.dashboard.DashboardFragment; +import com.android.settings.search.BaseSearchIndexProvider; +import com.android.settings.security.ShowPasswordPreferenceController; +import com.android.settingslib.core.AbstractPreferenceController; +import com.android.settingslib.search.SearchIndexable; + +import java.util.ArrayList; +import java.util.List; + +@SearchIndexable +public class PrivacyDashboardFragment extends DashboardFragment { + private static final String TAG = "PrivacyDashboardFragment"; + + @Override + public int getMetricsCategory() { + return MetricsEvent.TOP_LEVEL_PRIVACY; + } + + @Override + protected String getLogTag() { + return TAG; + } + + @Override + protected int getPreferenceScreenResId() { + return R.xml.privacy_dashboard_settings; + } + + @Override + public int getHelpResource() { + return R.string.help_url_privacy_dashboard; + } + + public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = + new BaseSearchIndexProvider() { + @Override + public List getXmlResourcesToIndex(Context context, + boolean enabled) { + final ArrayList result = new ArrayList<>(); + + final SearchIndexableResource sir = new SearchIndexableResource(context); + sir.xmlResId = R.xml.privacy_dashboard_settings; + result.add(sir); + return result; + } + }; +}