Remove "Screen lock" category header as the title is sufficient.
Bug: 5203189 Insert a descriptive text as a header view when in weak biometric fallback case. Change-Id: Ic10cc7d276975b13c188bd15016fea2200ec0e5b
This commit is contained in:
24
res/layout/weak_biometric_fallback_header.xml
Normal file
24
res/layout/weak_biometric_fallback_header.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2011 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.
|
||||||
|
-->
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="8dip"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:text="@string/unlock_backup_info_summary"
|
||||||
|
/>
|
@@ -16,17 +16,6 @@
|
|||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:key="security_picker_category"
|
|
||||||
android:title="@string/lock_settings_picker_title">
|
|
||||||
|
|
||||||
<!-- TODO: find a better way to display this backup info -->
|
|
||||||
<PreferenceScreen
|
|
||||||
android:key="unlock_backup_info"
|
|
||||||
android:summary="@string/unlock_backup_info_summary"
|
|
||||||
android:selectable="false"
|
|
||||||
android:persistent="false"/>
|
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="unlock_set_off"
|
android:key="unlock_set_off"
|
||||||
android:title="@string/unlock_set_unlock_off_title"
|
android:title="@string/unlock_set_unlock_off_title"
|
||||||
@@ -63,6 +52,4 @@
|
|||||||
android:summary="@string/unlock_set_unlock_password_summary"
|
android:summary="@string/unlock_set_unlock_password_summary"
|
||||||
android:persistent="false"/>
|
android:persistent="false"/>
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -25,9 +25,12 @@ import android.os.Bundle;
|
|||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceCategory;
|
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.security.KeyStore;
|
import android.security.KeyStore;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
|
|
||||||
@@ -118,6 +121,21 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View v = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
final boolean onlyShowFallback = getActivity().getIntent()
|
||||||
|
.getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
|
||||||
|
if (onlyShowFallback) {
|
||||||
|
View header = v.inflate(getActivity(),
|
||||||
|
R.layout.weak_biometric_fallback_header, null);
|
||||||
|
((ListView) v.findViewById(android.R.id.list)).addHeaderView(header, null, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
@@ -205,30 +223,18 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
* @param quality the requested quality.
|
* @param quality the requested quality.
|
||||||
*/
|
*/
|
||||||
private void disableUnusablePreferences(final int quality) {
|
private void disableUnusablePreferences(final int quality) {
|
||||||
final Preference picker =
|
final PreferenceScreen entries = getPreferenceScreen();
|
||||||
getPreferenceScreen().findPreference("security_picker_category");
|
|
||||||
final PreferenceCategory cat = (PreferenceCategory) picker;
|
|
||||||
final int preferenceCount = cat.getPreferenceCount();
|
|
||||||
final boolean onlyShowFallback = getActivity().getIntent()
|
final boolean onlyShowFallback = getActivity().getIntent()
|
||||||
.getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
|
.getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
|
||||||
final boolean weakBiometricAvailable = isBiometricSensorAvailable(
|
final boolean weakBiometricAvailable = isBiometricSensorAvailable(
|
||||||
DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK);
|
DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK);
|
||||||
// TODO: This code can be removed once the second header is gone
|
for (int i = entries.getPreferenceCount() - 1; i >= 0; --i) {
|
||||||
if (onlyShowFallback) {
|
Preference pref = entries.getPreference(i);
|
||||||
picker.setTitle(R.string.backup_lock_settings_picker_title);
|
|
||||||
} else {
|
|
||||||
picker.setTitle(R.string.lock_settings_picker_title);
|
|
||||||
}
|
|
||||||
for (int i = preferenceCount-1; i >= 0; --i) {
|
|
||||||
Preference pref = cat.getPreference(i);
|
|
||||||
if (pref instanceof PreferenceScreen) {
|
if (pref instanceof PreferenceScreen) {
|
||||||
final String key = ((PreferenceScreen) pref).getKey();
|
final String key = ((PreferenceScreen) pref).getKey();
|
||||||
boolean enabled = true;
|
boolean enabled = true;
|
||||||
boolean visible = true;
|
boolean visible = true;
|
||||||
if (KEY_UNLOCK_BACKUP_INFO.equals(key)) {
|
if (KEY_UNLOCK_SET_OFF.equals(key)) {
|
||||||
enabled = true;
|
|
||||||
visible = onlyShowFallback;
|
|
||||||
} else if (KEY_UNLOCK_SET_OFF.equals(key)) {
|
|
||||||
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
||||||
} else if (KEY_UNLOCK_SET_NONE.equals(key)) {
|
} else if (KEY_UNLOCK_SET_NONE.equals(key)) {
|
||||||
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
||||||
@@ -243,7 +249,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
|
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
|
||||||
}
|
}
|
||||||
if (!visible || (onlyShowFallback && !allowedForFallback(key))) {
|
if (!visible || (onlyShowFallback && !allowedForFallback(key))) {
|
||||||
cat.removePreference(pref);
|
entries.removePreference(pref);
|
||||||
} else if (!enabled) {
|
} else if (!enabled) {
|
||||||
pref.setSummary(R.string.unlock_set_unlock_disabled_summary);
|
pref.setSummary(R.string.unlock_set_unlock_disabled_summary);
|
||||||
pref.setEnabled(false);
|
pref.setEnabled(false);
|
||||||
|
Reference in New Issue
Block a user