Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 930df91e authored by Salud Lemus's avatar Salud Lemus
Browse files

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
parent 88cd3dae
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -11522,6 +11522,25 @@
    <!-- Button label to allow the user to view additional information [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=2416766240581561009] -->
    <string name="learn_more">Learn more</string>
    <!-- Financed device Privacy --> <skip />
    <!-- Title of setting on security settings screen on a financed device. This will take the user to a screen with information about what a device administrator can control and their impact on the user's privacy on a financed device. Shown on financed-managed devices only. [CHAR LIMIT=NONE] -->
    <string name="financed_privacy_settings">Financed device info</string>
    <!-- Section header. This section shows what information a device administrator can see on a financed device. [CHAR LIMIT=60] -->
    <string name="financed_privacy_exposure_category">Types of information your device administrator can see</string>
    <!-- Label explaining that the device administrator can see data associated on the user's financed device. [CHAR LIMIT=NONE] -->
    <string name="financed_privacy_data">Data associated with your account, such as email and calendar info</string>
    <!-- Section header. This section shows what changes a device administrator made to a financed device. [CHAR LIMIT=60] -->
    <string name="financed_privacy_exposure_changes_category">Changes made by your device administrator</string>
    <!-- Label explaining that the device admin can lock the device and change the user's password on their financed device. [CHAR LIMIT=NONE] -->
    <string name="financed_privacy_lock_device">Device administrator can lock this device and reset password</string>
    <!-- Label explaining that the device admin can wipe the device remotely for a financed device. [CHAR LIMIT=NONE] -->
    <string name="financed_privacy_wipe_device">Device administrator can delete all device data</string>
    <!-- Label explaining that the device admin configured the device to wipe itself when an incorrect password is entered too many times on a financed device. [CHAR LIMIT=NONE] -->
    <string name="financed_privacy_failed_password_wipe_device">Failed password attempts before deleting device data</string>
    <!-- Financed Privacy settings activity header, summarizing the changes a credit provider can make to a financed device. [CHAR LIMIT=NONE] -->
    <string name="financed_privacy_header">Your credit provider can change settings and install software on this device.\n\nTo learn more, contact your creditor provider.</string>
    <!-- Strings for displaying which applications were set as default for specific actions. -->
    <!-- Title for the apps that have been set as default handlers of camera-related intents. [CHAR LIMIT=30] -->
    <plurals name="default_camera_app_title">
+84 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2021 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.
  -->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/financed_privacy_settings">

    <PreferenceCategory android:key="exposure_category"
        android:order="200"
        android:title="@string/financed_privacy_exposure_category"
        android:contentDescription="@string/financed_privacy_exposure_category">
        <Preference android:key="enterprise_privacy_enterprise_data"
            android:order="210"
            android:layout_height="wrap_content"
            android:title="@string/financed_privacy_data"
            android:selectable="false"/>
        <Preference android:key="enterprise_privacy_installed_packages"
            android:order="220"
            android:title="@string/enterprise_privacy_installed_packages"
            android:selectable="false"/>
        <Preference android:key="enterprise_privacy_usage_stats"
            android:order="230"
            android:title="@string/enterprise_privacy_usage_stats"
            android:selectable="false"/>
        <Preference android:key="network_logs"
            android:order="240"
            android:title="@string/enterprise_privacy_network_logs"
            android:selectable="false"/>
        <Preference android:key="bug_reports"
            android:order="250"
            android:title="@string/enterprise_privacy_bug_reports"
            android:selectable="false"/>
        <Preference android:key="security_logs"
            android:order="260"
            android:title="@string/enterprise_privacy_security_logs"
            android:selectable="false"/>
    </PreferenceCategory>

    <PreferenceCategory android:title="@string/financed_privacy_exposure_changes_category"
        android:order="300"
        android:key="exposure_changes_category">
        <Preference android:fragment="com.android.settings.enterprise.ApplicationListFragment$EnterpriseInstalledPackages"
            android:order="310"
            android:key="number_enterprise_installed_packages"
            android:title="@string/enterprise_privacy_enterprise_installed_packages"/>
    </PreferenceCategory>

    <PreferenceCategory android:key="device_access_category"
        android:order="500"
        android:title="@string/enterprise_privacy_device_access_category">
        <Preference android:key="enterprise_privacy_lock_device"
            android:order="510"
            android:title="@string/financed_privacy_lock_device"
            android:selectable="false"/>
        <Preference android:key="enterprise_privacy_wipe_device"
            android:order="520"
            android:title="@string/financed_privacy_wipe_device"
            android:selectable="false"/>
        <Preference android:key="failed_password_wipe_current_user"
            android:order="530"
            android:title="@string/financed_privacy_failed_password_wipe_device"
            android:selectable="false"/>
    </PreferenceCategory>

    <com.android.settingslib.widget.FooterPreference
        android:key="financed_privacy_footer"
        android:title="@string/financed_privacy_header"
        android:selectable="false"
        settings:searchable="false"/>
</PreferenceScreen>
+37 −43
Original line number Diff line number Diff line
@@ -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 */);
                }
            };
}
+97 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.enterprise;

import android.content.Context;
import android.provider.SearchIndexableResource;

import com.android.settings.R;
import com.android.settings.widget.PreferenceCategoryController;
import com.android.settingslib.core.AbstractPreferenceController;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/** Privacy Settings preferences for an Enterprise device. */
public class PrivacySettingsEnterprisePreference implements PrivacySettingsPreference {
    private static final String KEY_EXPOSURE_CHANGES_CATEGORY = "exposure_changes_category";

    private final Context mContext;

    public PrivacySettingsEnterprisePreference(Context context) {
        mContext = context.getApplicationContext();
    }

    /**
     * Returns the XML Res Id that is used for an Enterprise device in the Privacy Settings screen.
     */
    @Override
    public int getPreferenceScreenResId() {
        return R.xml.enterprise_privacy_settings;
    }

    /**
     * Returns the Enterprise XML resources to index for an Enterprise device.
     */
    @Override
    public List<SearchIndexableResource> getXmlResourcesToIndex() {
        final SearchIndexableResource sir = new SearchIndexableResource(mContext);
        sir.xmlResId = getPreferenceScreenResId();
        return Collections.singletonList(sir);
    }

    /**
     * Returns the preference controllers used to populate the privacy preferences in the Privacy
     * Settings screen for Enterprise devices.
     */
    @Override
    public List<AbstractPreferenceController> createPreferenceControllers(boolean async) {
        final List<AbstractPreferenceController> controllers = new ArrayList<>();
        controllers.add(new NetworkLogsPreferenceController(mContext));
        controllers.add(new BugReportsPreferenceController(mContext));
        controllers.add(new SecurityLogsPreferenceController(mContext));
        final List<AbstractPreferenceController> exposureChangesCategoryControllers =
                new ArrayList<>();
        exposureChangesCategoryControllers.add(new EnterpriseInstalledPackagesPreferenceController(
                mContext, async));
        exposureChangesCategoryControllers.add(
                new AdminGrantedLocationPermissionsPreferenceController(mContext, async));
        exposureChangesCategoryControllers.add(
                new AdminGrantedMicrophonePermissionPreferenceController(mContext, async));
        exposureChangesCategoryControllers.add(new AdminGrantedCameraPermissionPreferenceController(
                mContext, async));
        exposureChangesCategoryControllers.add(new EnterpriseSetDefaultAppsPreferenceController(
                mContext));
        exposureChangesCategoryControllers.add(new AlwaysOnVpnCurrentUserPreferenceController(
                mContext));
        exposureChangesCategoryControllers.add(new AlwaysOnVpnManagedProfilePreferenceController(
                mContext));
        exposureChangesCategoryControllers.add(new ImePreferenceController(mContext));
        exposureChangesCategoryControllers.add(new GlobalHttpProxyPreferenceController(mContext));
        exposureChangesCategoryControllers.add(new CaCertsCurrentUserPreferenceController(
                mContext));
        exposureChangesCategoryControllers.add(new CaCertsManagedProfilePreferenceController(
                mContext));
        controllers.addAll(exposureChangesCategoryControllers);
        controllers.add(new PreferenceCategoryController(mContext, KEY_EXPOSURE_CHANGES_CATEGORY)
                .setChildren(exposureChangesCategoryControllers));
        controllers.add(new FailedPasswordWipeCurrentUserPreferenceController(mContext));
        controllers.add(new FailedPasswordWipeManagedProfilePreferenceController(mContext));
        return controllers;
    }
}
+78 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.enterprise;

import android.content.Context;
import android.provider.SearchIndexableResource;

import com.android.settings.R;
import com.android.settings.widget.PreferenceCategoryController;
import com.android.settingslib.core.AbstractPreferenceController;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/** Privacy Settings preferences for a financed device. */
public class PrivacySettingsFinancedPreference implements PrivacySettingsPreference {
    private static final String KEY_EXPOSURE_CHANGES_CATEGORY = "exposure_changes_category";

    private final Context mContext;

    public PrivacySettingsFinancedPreference(Context context) {
        mContext = context.getApplicationContext();
    }

    /**
     * Returns the XML Res Id that is used for financed devices in the Privacy Settings screen.
     */
    @Override
    public int getPreferenceScreenResId() {
        return R.xml.financed_privacy_settings;
    }

    /**
     * Returns the XML resources to index for a financed device.
     */
    @Override
    public List<SearchIndexableResource> getXmlResourcesToIndex() {
        final SearchIndexableResource sir = new SearchIndexableResource(mContext);
        sir.xmlResId = getPreferenceScreenResId();
        return Collections.singletonList(sir);
    }

    /**
     * Returns the preference controllers used to populate the privacy preferences in the Privacy
     * Settings screen for a financed device.
     */
    @Override
    public List<AbstractPreferenceController> createPreferenceControllers(boolean async) {
        final List<AbstractPreferenceController> controllers = new ArrayList<>();
        controllers.add(new NetworkLogsPreferenceController(mContext));
        controllers.add(new BugReportsPreferenceController(mContext));
        controllers.add(new SecurityLogsPreferenceController(mContext));
        final List<AbstractPreferenceController> exposureChangesCategoryControllers =
                new ArrayList<>();
        exposureChangesCategoryControllers.add(new EnterpriseInstalledPackagesPreferenceController(
                mContext, async));
        controllers.addAll(exposureChangesCategoryControllers);
        controllers.add(new PreferenceCategoryController(mContext, KEY_EXPOSURE_CHANGES_CATEGORY)
                .setChildren(exposureChangesCategoryControllers));
        controllers.add(new FailedPasswordWipeCurrentUserPreferenceController(mContext));
        return controllers;
    }
}
Loading