Merge cherrypicks of [7825093, 7824346, 7824349, 7823902, 7823903, 7825189, 7825190, 7825191, 7825192, 7825193, 7825195, 7825196, 7825197, 7825204, 7825205, 7825206, 7825207, 7825208, 7825209, 7825210, 7825211
, 7825618, 7825619, 7825620, 7825621, 7825622, 7825623, 7825521, 7825522, 7825523, 7825524, 7825525, 7825698, 7825699] into qt-c2f2-release
Change-Id: I6ece4b4fa6b5537024b650d8c1f6af66b45fcb3c
This commit is contained in:
@@ -885,7 +885,7 @@
|
||||
<!-- Message shown in summary field when face unlock is set up. [CHAR LIMIT=40] -->
|
||||
<string name="security_settings_face_preference_summary">Face added</string>
|
||||
<!-- Message shown in summary field when face unlock is not set up. [CHAR LIMIT=54] -->
|
||||
<string name="security_settings_face_preference_summary_none">Tap to set up face unlock</string>
|
||||
<string name="security_settings_face_preference_summary_none">Set up face unlock</string>
|
||||
<!-- Title shown for menu item that launches face settings or enrollment. [CHAR LIMIT=32] -->
|
||||
<string name="security_settings_face_preference_title">Face unlock</string>
|
||||
<!-- Introduction title shown in face enrollment education screen [CHAR LIMIT=40] -->
|
||||
@@ -955,25 +955,25 @@
|
||||
<!-- Text shown on a toggle which allows or disallows the device to use face unlock for apps. This will be presented to the user together with the context of security_settings_face_settings_use_face_category. [CHAR LIMIT=30] -->
|
||||
<string name="security_settings_face_settings_use_face_for_apps">App sign-in \u0026 payments</string>
|
||||
<!-- Title for a category shown for the face settings page, followed by items that the user can toggle on/off to require/disable. -->
|
||||
<string name="security_settings_face_settings_require_category">Require for face unlock</string>
|
||||
<string name="security_settings_face_settings_require_category">Requirements for face unlock</string>
|
||||
<!-- Text shown on a toggle which disables/enables face unlock, depending if the user's eyes are open. [CHAR LIMIT=30] -->
|
||||
<string name="security_settings_face_settings_require_attention">Open eyes looking at screen</string>
|
||||
<string name="security_settings_face_settings_require_attention">Require eyes to be open</string>
|
||||
<!-- Text shown on the details of a toggle which disables/enables face unlock, depending if the user's eyes are open. [CHAR LIMIT=70] -->
|
||||
<string name="security_settings_face_settings_require_attention_details">To unlock the phone, always require looking at the screen with your eyes open</string>
|
||||
<string name="security_settings_face_settings_require_attention_details">To unlock the phone, your eyes must be open</string>
|
||||
<!-- When authenticating in apps, always require confirmation (e.g. confirm button) after a face is authenticated. [CHAR LIMIT=50] -->
|
||||
<string name="security_settings_face_settings_require_confirmation">Confirm button</string>
|
||||
<string name="security_settings_face_settings_require_confirmation">Always require confirmation</string>
|
||||
<!-- When authenticating in apps, always require confirmation (e.g. confirm button) after a face is authenticated. [CHAR LIMIT=70] -->
|
||||
<string name="security_settings_face_settings_require_confirmation_details">When authenticating for apps, always require confirmation</string>
|
||||
<string name="security_settings_face_settings_require_confirmation_details">When using face unlock in apps, always require confirmation step</string>
|
||||
<!-- Button text in face settings which removes the user's faces from the device [CHAR LIMIT=20] -->
|
||||
<string name="security_settings_face_settings_remove_face_data">Delete face data</string>
|
||||
<!-- Button text in face settings which lets the user enroll their face [CHAR LIMIT=40] -->
|
||||
<string name="security_settings_face_settings_enroll">Set up new face unlock</string>
|
||||
<string name="security_settings_face_settings_enroll">Set up face unlock</string>
|
||||
<!-- Text shown in face settings explaining what your face can be used for. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_settings_footer">Use face unlock to unlock your device, sign in to apps, and confirm payments.\n\nKeep in mind:\nLooking at the phone can unlock it when you don\u2019t intend to.\n\nYour phone can be unlocked by someone else if it\u2019s held up to your face while your eyes are open.\n\nYour phone can be unlocked by someone who looks a lot like you, say, an identical sibling.</string>
|
||||
<!-- Dialog title shown when the user removes an enrollment [CHAR LIMIT=35] -->
|
||||
<string name="security_settings_face_settings_remove_dialog_title">Delete face data?</string>
|
||||
<!-- Dialog contents shown when the user removes an enrollment [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_settings_remove_dialog_details">Data recorded by face unlock will be permanently and securely deleted. After removal, you will need your PIN, pattern, or password to unlock your phone, sign in to apps, and confirm payments.</string>
|
||||
<string name="security_settings_face_settings_remove_dialog_details">The images and biometric data used by face unlock will be permanently and securely deleted. After removal, you will need your PIN, pattern, or password to unlock your phone, sign in to apps, and confirm payments.</string>
|
||||
|
||||
|
||||
<!-- Fingerprint enrollment and settings --><skip />
|
||||
@@ -1075,11 +1075,11 @@
|
||||
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set fingerprint. (default) [CHAR LIMIT=NONE] -->
|
||||
<string name="fingerprint_lock_screen_setup_skip_dialog_text" product="default">Protect your phone with a screen lock option so no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up fingerprint. Tap Cancel, then set a PIN, pattern, or password.</string>
|
||||
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set face unlock. (tablet) [CHAR LIMIT=NONE] -->
|
||||
<string name="face_lock_screen_setup_skip_dialog_text" product="tablet">Protect your tablet with a screen lock option so no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up face unlock. Tap Cancel, then set a PIN, pattern, or password.</string>
|
||||
<string name="face_lock_screen_setup_skip_dialog_text" product="tablet">By protecting your tablet with a screen lock option, no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up face unlock. To go back, tap Cancel. </string>
|
||||
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set face unlock. (device) [CHAR LIMIT=NONE] -->
|
||||
<string name="face_lock_screen_setup_skip_dialog_text" product="device">Protect your device with a screen lock option so no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up face unlock. Tap Cancel, then set a PIN, pattern, or password.</string>
|
||||
<string name="face_lock_screen_setup_skip_dialog_text" product="device">By protecting your device with a screen lock option, no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up face unlock. To go back, tap Cancel. </string>
|
||||
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set face unlock. (default) [CHAR LIMIT=NONE] -->
|
||||
<string name="face_lock_screen_setup_skip_dialog_text" product="default">Protect your phone with a screen lock option so no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up face unlock. Tap Cancel, then set a PIN, pattern, or password.</string>
|
||||
<string name="face_lock_screen_setup_skip_dialog_text" product="default">By protecting your phone with a screen lock option, no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up face unlock. To go back, tap Cancel.</string>
|
||||
<!-- Title of dialog shown when the user tries to skip setting up a PIN, warning them of potential consequences of not doing so [CHAR LIMIT=48]-->
|
||||
<string name="lock_screen_pin_skip_title">Skip PIN setup?</string>
|
||||
<!-- Title of dialog shown when the user tries to skip setting up a password, warning them of potential consequences of not doing so [CHAR LIMIT=48]-->
|
||||
@@ -7976,6 +7976,15 @@
|
||||
<!-- Configure Notifications: Title for the option controlling notifications on the lockscreen. [CHAR LIMIT=30] -->
|
||||
<string name="lock_screen_notifications_title">Lock screen</string>
|
||||
|
||||
<!-- Configure lock screen: Title for the option of unlocking directly to home. [CHAR LIMIT=30] -->
|
||||
<string name="lockscreen_bypass_title">Skip lock screen</string>
|
||||
|
||||
<!-- Configure lock screen: Summary for the option of unlocking directly to home. [CHAR LIMIT=60] -->
|
||||
<string name="lockscreen_bypass_summary">After face unlock, go directly to last used screen</string>
|
||||
|
||||
<!-- Configure lock screen: Search keywords for the option of unlocking directly to home. [CHAR LIMIT=60] -->
|
||||
<string name="keywords_lockscreen_bypass">Lock screen, Lockscreen, Skip, Bypass</string>
|
||||
|
||||
<!-- Configure Notifications: Title for the option controlling notifications for work profile. [CHAR LIMIT=30] -->
|
||||
<string name="locked_work_profile_notification_title">When work profile is locked</string>
|
||||
|
||||
|
@@ -62,6 +62,14 @@
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<!-- Bypass lock screen -->
|
||||
<SwitchPreference
|
||||
android:key="privacy_lockscreen_bypass"
|
||||
android:title="@string/lockscreen_bypass_title"
|
||||
android:summary="@string/lockscreen_bypass_summary"
|
||||
settings:keywords="@string/keywords_lockscreen_bypass"
|
||||
settings:controller="com.android.settings.security.LockscreenBypassPreferenceController" />
|
||||
|
||||
<!-- Privacy Service -->
|
||||
<PreferenceCategory
|
||||
android:key="privacy_services"
|
||||
|
@@ -30,6 +30,13 @@
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:keywords="@string/keywords_lock_screen_notif"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="security_lockscreen_bypass"
|
||||
android:title="@string/lockscreen_bypass_title"
|
||||
android:summary="@string/lockscreen_bypass_summary"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.security.LockscreenBypassPreferenceController" />
|
||||
|
||||
<com.android.settingslib.RestrictedSwitchPreference
|
||||
android:key="security_lockscreen_add_users_when_locked"
|
||||
android:title="@string/user_add_on_lockscreen_menu"
|
||||
|
@@ -145,7 +145,11 @@ public class FaceSettings extends DashboardFragment {
|
||||
if (savedInstanceState != null) {
|
||||
mToken = savedInstanceState.getByteArray(KEY_TOKEN);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (mToken == null) {
|
||||
final long challenge = mFaceManager.generateChallenge();
|
||||
ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
|
||||
@@ -155,13 +159,7 @@ public class FaceSettings extends DashboardFragment {
|
||||
Log.e(TAG, "Password not set");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (mToken != null) {
|
||||
} else {
|
||||
mAttentionController.setToken(mToken);
|
||||
mEnrollController.setToken(mToken);
|
||||
}
|
||||
@@ -196,13 +194,12 @@ public class FaceSettings extends DashboardFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (getActivity().isFinishing()) {
|
||||
final int result = mFaceManager.revokeChallenge();
|
||||
if (result < 0) {
|
||||
Log.w(TAG, "revokeChallenge failed, result: " + result);
|
||||
}
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
mToken = null;
|
||||
final int result = mFaceManager.revokeChallenge();
|
||||
if (result < 0) {
|
||||
Log.w(TAG, "revokeChallenge failed, result: " + result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -64,7 +64,7 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference
|
||||
|
||||
builder.setTitle(R.string.security_settings_face_settings_remove_dialog_title)
|
||||
.setMessage(R.string.security_settings_face_settings_remove_dialog_details)
|
||||
.setPositiveButton(R.string.okay, mOnClickListener)
|
||||
.setPositiveButton(R.string.delete, mOnClickListener)
|
||||
.setNegativeButton(R.string.cancel, mOnClickListener);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
|
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.hardware.face.FaceManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
|
||||
public class LockscreenBypassPreferenceController extends TogglePreferenceController {
|
||||
|
||||
@VisibleForTesting
|
||||
protected FaceManager mFaceManager;
|
||||
|
||||
public LockscreenBypassPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
mFaceManager = context.getSystemService(FaceManager.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
boolean defaultValue = mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_faceAuthDismissesKeyguard);
|
||||
return Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD, defaultValue ? 1 : 0) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD, isChecked ? 1 : 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
if (mFaceManager != null && mFaceManager.isHardwareDetected()) {
|
||||
return mFaceManager.hasEnrolledTemplates() ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
|
||||
} else {
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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 static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class LockscreenBypassPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private FaceManager mFaceManager;
|
||||
private SwitchPreference mPreference;
|
||||
|
||||
private Context mContext;
|
||||
private LockscreenBypassPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mPreference = new SwitchPreference(mContext);
|
||||
|
||||
mController = new LockscreenBypassPreferenceController(mContext, "TestKey");
|
||||
ReflectionHelpers.setField(mController, "mFaceManager", mFaceManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAvailable_whenHardwareDetected() {
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_settingIsUpdated() {
|
||||
boolean defaultValue = mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_faceAuthDismissesKeyguard);
|
||||
boolean state = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD, defaultValue ? 1 : 0) != 0;
|
||||
|
||||
assertThat(mController.onPreferenceChange(mPreference, !state)).isTrue();
|
||||
boolean newState = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD, 0) != 0;
|
||||
assertThat(newState).isEqualTo(!state);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user