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

Commit af5a0151 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add missing settings strings." into tm-dev

parents 434009d7 b7f4f56c
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
    <TextView
    <TextView
            android:layout_width="match_parent"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/admin_disabled_other_options_text"
            android:text="@string/admin_disabled_other_options" />
            android:text="@string/admin_disabled_other_options" />
    <TextView android:id="@+id/admin_more_details_link"
    <TextView android:id="@+id/admin_more_details_link"
            android:layout_width="wrap_content"
            android:layout_width="wrap_content"
+8 −8
Original line number Original line Diff line number Diff line
@@ -7617,15 +7617,15 @@
        <item quantity="other">Trust or remove certificates</item>
        <item quantity="other">Trust or remove certificates</item>
    </plurals>
    </plurals>
    <!-- Text of message to show to device owner user whose administrator has installed a SSL CA Cert.  [CHAR LIMIT=NONE] -->
    <!-- Text of message to show to device owner user whose administrator has installed a SSL CA Cert.  [CHAR LIMIT=NONE] -->
    <plurals name="ssl_ca_cert_info_message_device_owner">
    <string name="ssl_ca_cert_info_message_device_owner"> {numberOfCertificates, plural,
        <item quantity="one"><xliff:g id="managing_domain">%s</xliff:g> has installed a certificate authority on your device, which may allow them to monitor your device network activity, including emails, apps, and secure websites.\n\nFor more information about this certificate, contact your admin.</item>
        =1 {{orgName} has installed a certificate authority on your device, which may allow them to monitor your device network activity, including emails, apps, and secure websites.\n\nFor more information about this certificate, contact your admin.}
        <item quantity="other"><xliff:g id="managing_domain">%s</xliff:g> has installed certificate authorities on your device, which may allow them to monitor your device network activity, including emails, apps, and secure websites.\n\nFor more information about these certificates, contact your admin.</item>
        other {{orgName} has installed certificate authorities on your device, which may allow them to monitor your device network activity, including emails, apps, and secure websites.\n\nFor more information about these certificates, contact your admin.}
    </plurals>
        }</string>
    <!-- Text of message to show to work profile users whose administrator has installed a SSL CA Cert.  [CHAR LIMIT=NONE] -->
    <!-- Text of message to show to work profile users whose administrator has installed a SSL CA Cert.  [CHAR LIMIT=NONE] -->
    <plurals name="ssl_ca_cert_info_message">
    <string name="ssl_ca_cert_info_message">{numberOfCertificates, plural,
        <item quantity="one"><xliff:g id="managing_domain">%s</xliff:g> has installed a certificate authority for your work profile, which may allow them to monitor work network activity, including emails, apps, and secure websites.\n\nFor more information about this certificate, contact your admin.</item>
        =1 {{orgName} has installed a certificate authority for your work profile, which may allow them to monitor work network activity, including emails, apps, and secure websites.\n\nFor more information about this certificate, contact your admin.}
        <item quantity="other"><xliff:g id="managing_domain">%s</xliff:g> has installed certificate authorities for your work profile, which may allow them to monitor work network activity, including emails, apps, and secure websites.\n\nFor more information about these certificates, contact your admin.</item>
        other {{orgName} has installed certificate authorities for your work profile, which may allow them to monitor work network activity, including emails, apps, and secure websites.\n\nFor more information about these certificates, contact your admin.}
    </plurals>
        }</string>
    <!-- Text of warning to show to users that have a SSL CA Cert installed.  [CHAR LIMIT=NONE] -->
    <!-- Text of warning to show to users that have a SSL CA Cert installed.  [CHAR LIMIT=NONE] -->
    <string name="ssl_ca_cert_warning_message">A third party is capable of monitoring your network activity, including emails, apps, and secure websites.\n\nA trusted credential installed on your device is making this possible.</string>
    <string name="ssl_ca_cert_warning_message">A third party is capable of monitoring your network activity, including emails, apps, and secure websites.\n\nA trusted credential installed on your device is making this possible.</string>
    <!-- Label on button that will take the user to the Trusted Credentials settings page.  [CHAR LIMIT=NONE]-->
    <!-- Label on button that will take the user to the Trusted Credentials settings page.  [CHAR LIMIT=NONE]-->
+1 −0
Original line number Original line Diff line number Diff line
@@ -23,5 +23,6 @@


    <com.android.settingslib.widget.FooterPreference
    <com.android.settingslib.widget.FooterPreference
            android:title="@string/enterprise_privacy_apps_count_estimation_info"
            android:title="@string/enterprise_privacy_apps_count_estimation_info"
            android:key="enterprise_privacy_apps_footer"
            android:selectable="false"/>
            android:selectable="false"/>
</PreferenceScreen>
</PreferenceScreen>
+31 −5
Original line number Original line Diff line number Diff line
@@ -16,12 +16,16 @@


package com.android.settings;
package com.android.settings;


import static android.app.admin.DevicePolicyResources.Strings.Settings.DEVICE_OWNER_INSTALLED_CERTIFICATE_AUTHORITY_WARNING;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_INSTALLED_CERTIFICATE_AUTHORITY_WARNING;

import android.app.Activity;
import android.app.Activity;
import android.app.admin.DevicePolicyManager;
import android.app.admin.DevicePolicyManager;
import android.content.DialogInterface;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnDismissListener;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.content.Intent;
import android.icu.text.MessageFormat;
import android.os.Bundle;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings;
@@ -30,6 +34,10 @@ import androidx.appcompat.app.AlertDialog;


import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtils;


import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

/**
/**
 * Activity that shows a dialog explaining that a CA cert is allowing someone to monitor network
 * Activity that shows a dialog explaining that a CA cert is allowing someone to monitor network
 * traffic. This activity should be launched for the user into which the CA cert is installed
 * traffic. This activity should be launched for the user into which the CA cert is installed
@@ -71,12 +79,30 @@ public class MonitoringCertInfoActivity extends Activity implements OnClickListe
        builder.setOnDismissListener(this);
        builder.setOnDismissListener(this);


        if (dpm.getProfileOwnerAsUser(mUserId) != null) {
        if (dpm.getProfileOwnerAsUser(mUserId) != null) {
            builder.setMessage(getResources().getQuantityString(R.plurals.ssl_ca_cert_info_message,
            MessageFormat msgFormat = new MessageFormat(
                    numberOfCertificates, dpm.getProfileOwnerNameAsUser(mUserId)));
                    dpm.getResources().getString(
                            WORK_PROFILE_INSTALLED_CERTIFICATE_AUTHORITY_WARNING,
                            () -> getString(R.string.ssl_ca_cert_info_message)),
                    Locale.getDefault());

            Map<String, Object> arguments = new HashMap<>();
            arguments.put("numberOfCertificates", numberOfCertificates);
            arguments.put("orgName", dpm.getProfileOwnerNameAsUser(mUserId));

            builder.setMessage(msgFormat.format(arguments));
        } else if (dpm.getDeviceOwnerComponentOnCallingUser() != null) {
        } else if (dpm.getDeviceOwnerComponentOnCallingUser() != null) {
            builder.setMessage(getResources().getQuantityString(
            MessageFormat msgFormat = new MessageFormat(
                    R.plurals.ssl_ca_cert_info_message_device_owner, numberOfCertificates,
                    dpm.getResources()
                    dpm.getDeviceOwnerNameOnAnyUser()));
                            .getString(DEVICE_OWNER_INSTALLED_CERTIFICATE_AUTHORITY_WARNING,
                                    () -> getResources().getString(
                                            R.string.ssl_ca_cert_info_message_device_owner)),
                    Locale.getDefault());

            Map<String, Object> arguments = new HashMap<>();
            arguments.put("numberOfCertificates", numberOfCertificates);
            arguments.put("orgName", dpm.getDeviceOwnerNameOnAnyUser());

            builder.setMessage(msgFormat.format(arguments));
        } else  {
        } else  {
            // Consumer case.  Show scary warning.
            // Consumer case.  Show scary warning.
            builder.setIcon(android.R.drawable.stat_notify_error);
            builder.setIcon(android.R.drawable.stat_notify_error);
+34 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.settings;


import android.app.Activity;
import android.app.Activity;
import android.app.Dialog;
import android.app.Dialog;
import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface;
@@ -70,6 +71,7 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF


    private static final int ORDER_FIRST = -1;
    private static final int ORDER_FIRST = -1;


    protected DevicePolicyManager mDevicePolicyManager;
    private SettingsDialogFragment mDialogFragment;
    private SettingsDialogFragment mDialogFragment;
    // Cache the content resolver for async callbacks
    // Cache the content resolver for async callbacks
    private ContentResolver mContentResolver;
    private ContentResolver mContentResolver;
@@ -135,6 +137,7 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
    public void onCreate(Bundle icicle) {
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        super.onCreate(icicle);


        mDevicePolicyManager = getContext().getSystemService(DevicePolicyManager.class);
        if (icicle != null) {
        if (icicle != null) {
            mPreferenceHighlighted = icicle.getBoolean(SAVE_HIGHLIGHTED_KEY);
            mPreferenceHighlighted = icicle.getBoolean(SAVE_HIGHLIGHTED_KEY);
        }
        }
@@ -728,4 +731,35 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
        final Activity activity = getActivity();
        final Activity activity = getActivity();
        return activity == null || activity.isFinishing() || activity.isDestroyed();
        return activity == null || activity.isFinishing() || activity.isDestroyed();
    }
    }

    protected void replaceEnterprisePreferenceScreenTitle(String overrideKey, int resource) {
        getActivity().setTitle(mDevicePolicyManager.getResources().getString(
                overrideKey, () -> getString(resource)));
    }

    protected void replaceEnterpriseStringSummary(
            String preferenceKey, String overrideKey, int resource) {
        Preference preference = findPreference(preferenceKey);
        if (preference == null) {
            Log.d(TAG, "Could not find enterprise preference " + preferenceKey);
            return;
        }

        preference.setSummary(
                mDevicePolicyManager.getResources().getString(overrideKey,
                        () -> getString(resource)));
    }

    protected void replaceEnterpriseStringTitle(
            String preferenceKey, String overrideKey, int resource) {
        Preference preference = findPreference(preferenceKey);
        if (preference == null) {
            Log.d(TAG, "Could not find enterprise preference " + preferenceKey);
            return;
        }

        preference.setTitle(
                mDevicePolicyManager.getResources().getString(overrideKey,
                        () -> getString(resource)));
    }
}
}
Loading