Credential management app UI tweaks
Credential management app Settings screen * Add uninstall certificates button * Reformat summary * Remove dividing lines Request manage credentials screen * Make requesting app name bold Manual testing * Install TestDPC and select 'Request to manage credentials' * Verify app name is bold and select allow * Install a certificate as the cred mng app via TestDPC * Go to Setting > Security > Encryption & Credentials > Credential Management App * Verify screen looks like mocks * Select 'Remove certificates' and verify all certificates installed by the cred mng app are removed Settings screen: https://screenshot.googleplex.com/C6n9bnwkw843jgf Request screen: https://screenshot.googleplex.com/5qH44NXKKGRsdHs Bug: 189416800 Test: manual testing CredentialManagementAppControllerTest CredentialManagementAppFragmentTest CredentialManagementAppButtonsControllerTest CredentialManagementAppHeaderControllerTest RequestManageCredentialsTest Change-Id: I71334b231ae7cefbc055e2575eda5418da2548b4
This commit is contained in:
25
res/drawable/ic_upload.xml
Normal file
25
res/drawable/ic_upload.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24.0dp"
|
||||
android:height="24.0dp"
|
||||
android:tint="?android:attr/colorControlNormal"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M18,15v3H6v-3H4v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3H18z M7,9l1.41,1.41L11,7.83V16h2V7.83l2.59,2.58L17,9l-5-5L7,9z" />
|
||||
</vector>
|
@@ -6784,9 +6784,9 @@
|
||||
<string name="cert_not_installed">Certificate not installed</string>
|
||||
|
||||
<!-- Title of screen shown to the user when an app requests to manage the user's KeyChain credentials [CHAR LIMIT=NONE] -->
|
||||
<string name="request_manage_credentials_title">Allow <xliff:g id="app_name" example="Ping">%s</xliff:g> to install certificates on this device?</string>
|
||||
<string name="request_manage_credentials_title">Allow <b><xliff:g id="app_name" example="Ping">^1</xliff:g></b> to install certificates on this device?</string>
|
||||
<!-- Description of screen shown to the user when an app requests to manage the user's KeyChain credentials [CHAR LIMIT=NONE] -->
|
||||
<string name="request_manage_credentials_description">These certificates will identify you to the apps and URLs below</string>
|
||||
<string name="request_manage_credentials_description">These certificates will verify you by sharing your device\u2019s unique ID with the apps and URLs below</string>
|
||||
<!-- Label for button to not allow an app to manage the user's KeyChain credentials [CHAR_LIMIT=50] -->
|
||||
<string name="request_manage_credentials_dont_allow">Don\u2019t allow</string>
|
||||
<!-- Label for button to allow an app to manage the user's KeyChain credentials [CHAR_LIMIT=50] -->
|
||||
@@ -6798,7 +6798,9 @@
|
||||
<!-- Summary if there is no certificate management app [CHAR_LIMIT=NONE] -->
|
||||
<string name="no_certificate_management_app">None</string>
|
||||
<!-- Summary of preference if there is a certificate management app [CHAR LIMIT=NONE] -->
|
||||
<string name="certificate_management_app_description">Certificates installed by this app identify you to the apps and URLs below</string>
|
||||
<string name="certificate_management_app_description">Certificates will verify you when you use the apps and URLs below</string>
|
||||
<!-- Label for button to uninstall all certificates installed by the credential management app [CHAR LIMIT=30] -->
|
||||
<string name="uninstall_certs_credential_management_app">Uninstall certificates</string>
|
||||
<!-- Label for button to remove the credential management app [CHAR LIMIT=30] -->
|
||||
<string name="remove_credential_management_app">Remove</string>
|
||||
<!-- List item found in the credential management app's authentication policy [CHAR LIMIT=NONE] -->
|
||||
|
@@ -835,6 +835,7 @@
|
||||
<item name="android:layout_marginTop">24dp</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:alpha">0.7</item>
|
||||
</style>
|
||||
|
||||
<style name="AppAuthenticationPolicyItem">
|
||||
|
@@ -27,19 +27,11 @@
|
||||
android:order="-10000"
|
||||
settings:controller="com.android.settings.security.CredentialManagementAppHeaderController"/>
|
||||
|
||||
<com.android.settingslib.widget.TopIntroPreference
|
||||
android:key="top_intro_request_manage_credentials"
|
||||
android:order="-9999"
|
||||
android:title="@string/request_manage_credentials_description"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<!-- Buttons -->
|
||||
<com.android.settingslib.widget.ActionButtonsPreference
|
||||
android:key="buttons"
|
||||
android:selectable="true"
|
||||
android:order="-9998"
|
||||
settings:allowDividerAbove="true"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:controller="com.android.settings.security.CredentialManagementAppButtonsController"/>
|
||||
|
||||
<!-- Authentication Policy -->
|
||||
@@ -47,7 +39,6 @@
|
||||
android:key="authentication_policy"
|
||||
android:layout="@layout/preference_category_no_label"
|
||||
android:title="@string/summary_placeholder"
|
||||
settings:allowDividerAbove="true"
|
||||
settings:controller="com.android.settings.security.CredentialManagementAppPolicyController"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@@ -21,6 +21,7 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.security.AppUriAuthenticationPolicy;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -85,11 +86,13 @@ public class CredentialManagementAppAdapter extends RecyclerView.Adapter<Recycle
|
||||
ApplicationInfo applicationInfo =
|
||||
mPackageManager.getApplicationInfo(mCredentialManagerPackage, 0);
|
||||
mAppIconView.setImageDrawable(mPackageManager.getApplicationIcon(applicationInfo));
|
||||
mTitleView.setText(mContext.getString(R.string.request_manage_credentials_title,
|
||||
mTitleView.setText(TextUtils.expandTemplate(
|
||||
mContext.getText(R.string.request_manage_credentials_title),
|
||||
applicationInfo.loadLabel(mPackageManager)));
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
mAppIconView.setImageDrawable(null);
|
||||
mTitleView.setText(mContext.getString(R.string.request_manage_credentials_title,
|
||||
mTitleView.setText(TextUtils.expandTemplate(
|
||||
mContext.getText(R.string.request_manage_credentials_title),
|
||||
mCredentialManagerPackage));
|
||||
}
|
||||
}
|
||||
|
@@ -80,12 +80,29 @@ public class CredentialManagementAppButtonsController extends BasePreferenceCont
|
||||
private void displayButtons(PreferenceScreen screen) {
|
||||
if (mHasCredentialManagerPackage) {
|
||||
((ActionButtonsPreference) screen.findPreference(getPreferenceKey()))
|
||||
.setButton1Text(R.string.remove_credential_management_app)
|
||||
.setButton1Icon(R.drawable.ic_undo_24)
|
||||
.setButton1OnClickListener(view -> removeCredentialManagementApp());
|
||||
.setButton1Text(R.string.uninstall_certs_credential_management_app)
|
||||
.setButton1Icon(R.drawable.ic_upload)
|
||||
.setButton1OnClickListener(view -> uninstallCertificates())
|
||||
.setButton2Text(R.string.remove_credential_management_app)
|
||||
.setButton2Icon(R.drawable.ic_delete)
|
||||
.setButton2OnClickListener(view -> removeCredentialManagementApp());
|
||||
}
|
||||
}
|
||||
|
||||
private void uninstallCertificates() {
|
||||
mExecutor.execute(() -> {
|
||||
try {
|
||||
IKeyChainService service = KeyChain.bind(mContext).getService();
|
||||
for (String existingAlias :
|
||||
service.getCredentialManagementAppPolicy().getAliases()) {
|
||||
service.removeKeyPair(existingAlias);
|
||||
}
|
||||
} catch (InterruptedException | RemoteException e) {
|
||||
Log.e(TAG, "Unable to uninstall certificates");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void removeCredentialManagementApp() {
|
||||
mExecutor.execute(() -> {
|
||||
try {
|
||||
|
@@ -83,7 +83,6 @@ public class CredentialManagementAppHeaderController extends BasePreferenceContr
|
||||
TextView titleView = headerPref.findViewById(R.id.entity_header_title);
|
||||
TextView summary1 = headerPref.findViewById(R.id.entity_header_summary);
|
||||
TextView summary2 = headerPref.findViewById(R.id.entity_header_second_summary);
|
||||
summary1.setVisibility(View.GONE);
|
||||
summary2.setVisibility(View.GONE);
|
||||
|
||||
try {
|
||||
@@ -91,6 +90,7 @@ public class CredentialManagementAppHeaderController extends BasePreferenceContr
|
||||
mPackageManager.getApplicationInfo(mCredentialManagerPackageName, 0);
|
||||
appIconView.setImageDrawable(mPackageManager.getApplicationIcon(applicationInfo));
|
||||
titleView.setText(applicationInfo.loadLabel(mPackageManager));
|
||||
summary1.setText(R.string.certificate_management_app_description);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
appIconView.setImageDrawable(null);
|
||||
titleView.setText(mCredentialManagerPackageName);
|
||||
|
Reference in New Issue
Block a user