Implement "More privacy settings"
Safety Center is enabled, the existing "Privacy" screen will be different in a few ways: 1. Its title will become "More privacy settings" 2. A few preferences will be hidden 3. A few preferences will be reworded 4. The ordering of a few preferences will change 5. The PRIVACY_SETTINGS intent will now point to Safety Center; PRIVACY_ADVANCED_SETTINGS will point to "More privacy settings". Test: manual Bug: 222127397 Change-Id: I74faf770babb34f775b2ef572248e550ea683ab3
This commit is contained in:
@@ -25,6 +25,7 @@ import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROF
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
@@ -36,6 +37,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@SearchIndexable
|
||||
@@ -72,12 +74,6 @@ public class PrivacyDashboardFragment extends DashboardFragment {
|
||||
replaceEnterpriseStringSummary("work_policy_info",
|
||||
WORK_PROFILE_PRIVACY_POLICY_INFO_SUMMARY,
|
||||
R.string.work_policy_privacy_settings_summary);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.privacy_dashboard_settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,6 +86,19 @@ public class PrivacyDashboardFragment extends DashboardFragment {
|
||||
return buildPreferenceControllers(context, getSettingsLifecycle());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return getPreferenceScreenResId(getContext());
|
||||
}
|
||||
|
||||
private static int getPreferenceScreenResId(Context context) {
|
||||
if (SafetyCenterManagerWrapper.get().isEnabled(context)) {
|
||||
return R.xml.privacy_advanced_settings;
|
||||
} else {
|
||||
return R.xml.privacy_dashboard_settings;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<AbstractPreferenceController> buildPreferenceControllers(
|
||||
Context context, Lifecycle lifecycle) {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
@@ -108,17 +117,19 @@ public class PrivacyDashboardFragment extends DashboardFragment {
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.privacy_dashboard_settings) {
|
||||
new BaseSearchIndexProvider() {
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||
Context context, boolean enabled) {
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = getPreferenceScreenResId(context);
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
||||
Context context) {
|
||||
return buildPreferenceControllers(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return !SafetyCenterManagerWrapper.get().isEnabled(context);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user