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

Commit 8ed25688 authored by Alex Johnston's avatar Alex Johnston Committed by Android (Google) Code Review
Browse files

Merge "Added functionality to select type of certificate to be installed from the Settings app"

parents c6decc2d 7659e53a
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -5834,10 +5834,8 @@
    <!-- Title of preference group for credential storage settings [CHAR LIMIT=30] -->
    <string name="credentials_title">Credential storage</string>
    <!-- Title of preference to install certificates from SD card [CHAR LIMIT=30] -->
    <string name="credentials_install" product="nosdcard">Install from storage</string>
    <!-- Title of preference to install certificates from SD card [CHAR LIMIT=30] -->
    <string name="credentials_install" product="default">Install from SD card</string>
    <!-- Title of preference to install certificates [CHAR LIMIT=30] -->
    <string name="credentials_install">Install a certificate</string>
    <!-- Summary of preference to install certificates from SD card [CHAR LIMIT=NONE] -->
    <string name="credentials_install_summary" product="nosdcard">Install certificates from storage</string>
    <!-- Summary of preference to install certificates from SD card [CHAR LIMIT=NONE] -->
@@ -5876,6 +5874,12 @@
    <string name="credentials_not_erased">Credential storage couldn\u2019t be erased.</string>
    <!-- Title of Usage Access preference item [CHAR LIMIT=30] -->
    <string name="usage_access_title">Apps with usage access</string>
    <!-- Title of CA certificate [CHAR LIMIT=30] -->
    <string name="ca_certificate">CA certificate</string>
    <!-- Title of User certificate [CHAR LIMIT=30] -->
    <string name="user_certificate">VPN &amp; app user certificate</string>
    <!-- Title of Wi-Fi certificate [CHAR LIMIT=30] -->
    <string name="wifi_certificate">Wi\u2011Fi certificate</string>
    <!-- Sound settings screen, setting check box label -->
    <string name="emergency_tone_title">Emergency dialing signal</string>
@@ -6833,6 +6837,8 @@
    <string name="help_url_security" translatable="false"></string>
    <!-- Help URL, Encryption settings [DO NOT TRANSLATE] -->
    <string name="help_url_encryption" translatable="false"></string>
    <!-- Help URL, Install certificate settings [DO NOT TRANSLATE] -->
    <string name="help_url_install_certificate" translatable="false"></string>
    <!-- Help URL, Tap & pay [DO NOT TRANSLATE] -->
    <string name="help_url_nfc_payment" translatable="false"></string>
    <!-- Help URL, Remote display [DO NOT TRANSLATE] -->
+3 −9
Original line number Diff line number Diff line
@@ -58,17 +58,11 @@
            settings:userRestriction="no_config_credentials" />

        <com.android.settingslib.RestrictedPreference
            android:key="credentials_install"
            android:key="install_certificate"
            android:title="@string/credentials_install"
            android:summary="@string/credentials_install_summary"
            settings:userRestriction="no_config_credentials">

            <intent
                android:action="android.credentials.INSTALL"
                android:targetPackage="com.android.certinstaller"
                android:targetClass="com.android.certinstaller.CertInstallerMain" />

        </com.android.settingslib.RestrictedPreference>
            android:fragment="com.android.settings.security.InstallCertificateFromStorage"
            settings:userRestriction="no_config_credentials" />

        <com.android.settingslib.RestrictedPreference
            android:key="credentials_reset"
+70 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2019 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/credentials_install"
    android:key="install_certificate_from_storage">

    <PreferenceCategory
        android:key="certificate_types">

        <Preference
            android:key="install_ca_certificate"
            android:title="@string/ca_certificate">

            <intent
                android:action="android.credentials.INSTALL"
                android:targetPackage="com.android.certinstaller"
                android:targetClass="com.android.certinstaller.CertInstallerMain">
                <!-- Same value as CERTIFICATE_USAGE_CA in keystore/java/android/security/Credentials.java -->
                <extra android:name="certificate_install_usage" android:value="ca"/>
            </intent>

        </Preference>

        <Preference
            android:key="install_user_certificate"
            android:title="@string/user_certificate">

            <intent
                android:action="android.credentials.INSTALL"
                android:targetPackage="com.android.certinstaller"
                android:targetClass="com.android.certinstaller.CertInstallerMain">
                <!-- Same value as CERTIFICATE_USAGE_USER in keystore/java/android/security/Credentials.java -->
                <extra android:name="certificate_install_usage" android:value="user"/>
            </intent>

        </Preference>

        <Preference
            android:key="install_wifi_certificate"
            android:title="@string/wifi_certificate">

            <intent
                android:action="android.credentials.INSTALL"
                android:targetPackage="com.android.certinstaller"
                android:targetClass="com.android.certinstaller.CertInstallerMain">
                <!-- Same value as CERTIFICATE_USAGE_WIFI in keystore/java/android/security/Credentials.java -->
                <extra android:name="certificate_install_usage" android:value="wifi"/>
            </intent>

        </Preference>

    </PreferenceCategory>

</PreferenceScreen>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ public class EncryptionAndCredential extends DashboardFragment {
        controllers.add(new CredentialStoragePreferenceController(context));
        controllers.add(new UserCredentialsPreferenceController(context));
        controllers.add(new ResetCredentialsPreferenceController(context, lifecycle));
        controllers.add(new InstallCredentialsPreferenceController(context));
        controllers.add(new InstallCertificatePreferenceController(context));
        return controllers;
    }

+42 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.security;

import android.content.Context;
import android.os.UserManager;

import com.android.settings.core.BasePreferenceController;

public class InstallCaCertificatePreferenceController extends
        BasePreferenceController {

    private static final String KEY_INSTALL_CA_CERTIFICATE = "install_ca_certificate";

    public InstallCaCertificatePreferenceController(Context context) {
        super(context, UserManager.DISALLOW_CONFIG_CREDENTIALS);
    }

    @Override
    public int getAvailabilityStatus() {
        return AVAILABLE;
    }

    @Override
    public String getPreferenceKey() {
        return KEY_INSTALL_CA_CERTIFICATE;
    }
}
Loading