Update Privacy Settings text for a financed device

Bug: 182802692
Test: Used a test device that is registered via ZT
Test: m RunSettingsRoboTests ROBOTEST_FILTER=EnterprisePrivacySettingsTest
Test: m RunSettingsRoboTests ROBOTEST_FILTER=PrivacySettingsEnterprisePreferenceTest
Test: m RunSettingsRoboTests ROBOTEST_FILTER=PrivacySettingsFinancedPreferenceTest

Change-Id: Icc131252430cd147e2a06ba2aa260f6ea26734bb
This commit is contained in:
Salud Lemus
2021-03-15 17:06:30 +00:00
parent 88cd3dae5f
commit 930df91e66
11 changed files with 713 additions and 91 deletions

View File

@@ -20,16 +20,13 @@ import android.app.settings.SettingsEnums;
import android.content.Context;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.widget.PreferenceCategoryController;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@SearchIndexable
@@ -37,6 +34,23 @@ public class EnterprisePrivacySettings extends DashboardFragment {
static final String TAG = "EnterprisePrivacySettings";
@VisibleForTesting
PrivacySettingsPreference mPrivacySettingsPreference;
@Override
public void onAttach(Context context) {
mPrivacySettingsPreference =
PrivacySettingsPreferenceFactory.createPrivacySettingsPreference(context);
super.onAttach(context);
}
@Override
public void onDetach() {
mPrivacySettingsPreference = null;
super.onDetach();
}
@Override
public int getMetricsCategory() {
return SettingsEnums.ENTERPRISE_PRIVACY_SETTINGS;
@@ -49,47 +63,12 @@ public class EnterprisePrivacySettings extends DashboardFragment {
@Override
protected int getPreferenceScreenResId() {
return R.xml.enterprise_privacy_settings;
return mPrivacySettingsPreference.getPreferenceScreenResId();
}
@Override
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
return buildPreferenceControllers(context, true /* async */);
}
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
boolean async) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new NetworkLogsPreferenceController(context));
controllers.add(new BugReportsPreferenceController(context));
controllers.add(new SecurityLogsPreferenceController(context));
final List<AbstractPreferenceController> exposureChangesCategoryControllers =
new ArrayList<>();
exposureChangesCategoryControllers.add(new EnterpriseInstalledPackagesPreferenceController(
context, async));
exposureChangesCategoryControllers.add(
new AdminGrantedLocationPermissionsPreferenceController(context, async));
exposureChangesCategoryControllers.add(
new AdminGrantedMicrophonePermissionPreferenceController(context, async));
exposureChangesCategoryControllers.add(new AdminGrantedCameraPermissionPreferenceController(
context, async));
exposureChangesCategoryControllers.add(new EnterpriseSetDefaultAppsPreferenceController(
context));
exposureChangesCategoryControllers.add(new AlwaysOnVpnCurrentUserPreferenceController(
context));
exposureChangesCategoryControllers.add(new AlwaysOnVpnManagedProfilePreferenceController(
context));
exposureChangesCategoryControllers.add(new ImePreferenceController(context));
exposureChangesCategoryControllers.add(new GlobalHttpProxyPreferenceController(context));
exposureChangesCategoryControllers.add(new CaCertsCurrentUserPreferenceController(context));
exposureChangesCategoryControllers.add(new CaCertsManagedProfilePreferenceController(
context));
controllers.addAll(exposureChangesCategoryControllers);
controllers.add(new PreferenceCategoryController(context, "exposure_changes_category")
.setChildren(exposureChangesCategoryControllers));
controllers.add(new FailedPasswordWipeCurrentUserPreferenceController(context));
controllers.add(new FailedPasswordWipeManagedProfilePreferenceController(context));
return controllers;
return mPrivacySettingsPreference.createPreferenceControllers(true /* async */);
}
public static boolean isPageEnabled(Context context) {
@@ -99,17 +78,32 @@ public class EnterprisePrivacySettings extends DashboardFragment {
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.enterprise_privacy_settings) {
new BaseSearchIndexProvider() {
private PrivacySettingsPreference mPrivacySettingsPreference;
@Override
protected boolean isPageSearchEnabled(Context context) {
return isPageEnabled(context);
}
@Override
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
boolean enabled) {
mPrivacySettingsPreference =
PrivacySettingsPreferenceFactory.createPrivacySettingsPreference(
context);
return mPrivacySettingsPreference.getXmlResourcesToIndex();
}
@Override
public List<AbstractPreferenceController> createPreferenceControllers(
Context context) {
return buildPreferenceControllers(context, false /* async */);
mPrivacySettingsPreference =
PrivacySettingsPreferenceFactory.createPrivacySettingsPreference(
context);
return mPrivacySettingsPreference.createPreferenceControllers(
false /* async */);
}
};
}