Snap for 5656431 from ffcc25ba92 to qt-qpr1-release
Change-Id: Id5d7d97485fc8c8ae59fc72f9b943747c5d823b5
This commit is contained in:
@@ -6086,10 +6086,6 @@
|
|||||||
<string name="sms_access_restriction_enabled">Restrict SMS & call log access</string>
|
<string name="sms_access_restriction_enabled">Restrict SMS & call log access</string>
|
||||||
<!-- Summary for whether to enable SMS access restriction [CHAR LIMIT=NONE]-->
|
<!-- Summary for whether to enable SMS access restriction [CHAR LIMIT=NONE]-->
|
||||||
<string name="sms_access_restriction_enabled_summary">Only default phone and messaging apps have SMS & call log permissions</string>
|
<string name="sms_access_restriction_enabled_summary">Only default phone and messaging apps have SMS & call log permissions</string>
|
||||||
<!-- Title for the new device identifier access restrictions [CHAR LIMIT=50]-->
|
|
||||||
<string name="device_identifier_access_restrictions_title">Disable device identifier restrictions</string>
|
|
||||||
<!-- Summary for the new device identifier access restrictions [CHAR LIMIT=NONE]-->
|
|
||||||
<string name="device_identifier_access_restrictions_summary">Disable the new access restrictions for device identifiers</string>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Message when there are no available trust agents to display -->
|
<!-- Message when there are no available trust agents to display -->
|
||||||
|
|||||||
@@ -561,11 +561,6 @@
|
|||||||
android:title="@string/sms_access_restriction_enabled"
|
android:title="@string/sms_access_restriction_enabled"
|
||||||
android:summary="@string/sms_access_restriction_enabled_summary" />
|
android:summary="@string/sms_access_restriction_enabled_summary" />
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="device_identifier_access_restrictions"
|
|
||||||
android:title="@string/device_identifier_access_restrictions_title"
|
|
||||||
android:summary="@string/device_identifier_access_restrictions_summary" />
|
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="notification_bubbles"
|
android:key="notification_bubbles"
|
||||||
android:title="@string/notification_bubbles_title"
|
android:title="@string/notification_bubbles_title"
|
||||||
|
|||||||
@@ -62,14 +62,6 @@
|
|||||||
android:summary="@string/summary_placeholder"
|
android:summary="@string/summary_placeholder"
|
||||||
settings:searchable="false"/>
|
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 -->
|
<!-- Privacy Service -->
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="privacy_services"
|
android:key="privacy_services"
|
||||||
|
|||||||
@@ -30,13 +30,6 @@
|
|||||||
android:summary="@string/summary_placeholder"
|
android:summary="@string/summary_placeholder"
|
||||||
settings:keywords="@string/keywords_lock_screen_notif"/>
|
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
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
android:key="security_lockscreen_add_users_when_locked"
|
android:key="security_lockscreen_add_users_when_locked"
|
||||||
android:title="@string/user_add_on_lockscreen_menu"
|
android:title="@string/user_add_on_lockscreen_menu"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:key="security_settings_face_settings_page"
|
android:key="security_settings_face_settings_page"
|
||||||
android:title="@string/security_settings_face_preference_title">
|
android:title="@string/security_settings_face_preference_title">
|
||||||
|
|
||||||
@@ -39,6 +40,12 @@
|
|||||||
android:title="@string/security_settings_face_settings_use_face_for_apps"
|
android:title="@string/security_settings_face_settings_use_face_for_apps"
|
||||||
app:keywords="@string/keywords_face_unlock"
|
app:keywords="@string/keywords_face_unlock"
|
||||||
app:controller="com.android.settings.biometrics.face.FaceSettingsAppPreferenceController"/>
|
app:controller="com.android.settings.biometrics.face.FaceSettingsAppPreferenceController"/>
|
||||||
|
<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.biometrics.face.FaceSettingsLockscreenBypassPreferenceController" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
|||||||
private boolean mHasPassword;
|
private boolean mHasPassword;
|
||||||
private boolean mBiometricUnlockDisabledByAdmin;
|
private boolean mBiometricUnlockDisabledByAdmin;
|
||||||
private TextView mErrorText;
|
private TextView mErrorText;
|
||||||
|
protected boolean mConfirmingCredentials;
|
||||||
|
protected boolean mNextClicked;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the biometric is disabled by a device administrator
|
* @return true if the biometric is disabled by a device administrator
|
||||||
@@ -149,10 +151,12 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
|||||||
|
|
||||||
if (!mHasPassword) {
|
if (!mHasPassword) {
|
||||||
// No password registered, launch into enrollment wizard.
|
// No password registered, launch into enrollment wizard.
|
||||||
|
mConfirmingCredentials = true;
|
||||||
launchChooseLock();
|
launchChooseLock();
|
||||||
} else if (mToken == null) {
|
} else if (mToken == null) {
|
||||||
// It's possible to have a token but mLaunchedConfirmLock == false, since
|
// It's possible to have a token but mLaunchedConfirmLock == false, since
|
||||||
// ChooseLockGeneric can pass us a token.
|
// ChooseLockGeneric can pass us a token.
|
||||||
|
mConfirmingCredentials = true;
|
||||||
launchConfirmLock(getConfirmLockTitleResId(), getChallenge());
|
launchConfirmLock(getConfirmLockTitleResId(), getChallenge());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,6 +186,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNextButtonClick(View view) {
|
protected void onNextButtonClick(View view) {
|
||||||
|
mNextClicked = true;
|
||||||
if (checkMaxEnrolled() == 0) {
|
if (checkMaxEnrolled() == 0) {
|
||||||
// Lock thingy is already set up, launch directly to the next page
|
// Lock thingy is already set up, launch directly to the next page
|
||||||
launchNextEnrollingActivity(mToken);
|
launchNextEnrollingActivity(mToken);
|
||||||
@@ -249,12 +254,14 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
|||||||
mToken = data.getByteArrayExtra(
|
mToken = data.getByteArrayExtra(
|
||||||
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
|
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
|
||||||
overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
|
overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
|
||||||
|
mConfirmingCredentials = false;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
setResult(resultCode, data);
|
setResult(resultCode, data);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
} else if (requestCode == CONFIRM_REQUEST) {
|
} else if (requestCode == CONFIRM_REQUEST) {
|
||||||
|
mConfirmingCredentials = false;
|
||||||
if (resultCode == RESULT_OK && data != null) {
|
if (resultCode == RESULT_OK && data != null) {
|
||||||
mToken = data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
|
mToken = data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
|
||||||
overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
|
overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
|||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
private Intent mResultIntent;
|
private Intent mResultIntent;
|
||||||
private TextView mDescriptionText;
|
private TextView mDescriptionText;
|
||||||
|
private boolean mNextClicked;
|
||||||
|
|
||||||
private CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
|
private CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
|
||||||
new CompoundButton.OnCheckedChangeListener() {
|
new CompoundButton.OnCheckedChangeListener() {
|
||||||
@@ -161,6 +162,10 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
|||||||
|
|
||||||
if (accessibilityEnabled) {
|
if (accessibilityEnabled) {
|
||||||
accessibilityButton.callOnClick();
|
accessibilityButton.callOnClick();
|
||||||
|
mSwitchDiversity.setClickable(true);
|
||||||
|
mSwitchDiversity.setOnClickListener(v -> {
|
||||||
|
mSwitchDiversity.getSwitch().toggle();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,6 +185,17 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
|
||||||
|
if (!isChangingConfigurations() && !WizardManagerHelper.isAnySetupWizard(getIntent())
|
||||||
|
&& !mNextClicked) {
|
||||||
|
setResult(RESULT_SKIP);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNextButtonClick(View view) {
|
protected void onNextButtonClick(View view) {
|
||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
@@ -189,6 +205,7 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
|||||||
if (mUserId != UserHandle.USER_NULL) {
|
if (mUserId != UserHandle.USER_NULL) {
|
||||||
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
|
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
|
||||||
}
|
}
|
||||||
|
intent.putExtra(EXTRA_FROM_SETTINGS_SUMMARY, mFromSettingsSummary);
|
||||||
final String flattenedString = getString(R.string.config_face_enroll);
|
final String flattenedString = getString(R.string.config_face_enroll);
|
||||||
if (!TextUtils.isEmpty(flattenedString)) {
|
if (!TextUtils.isEmpty(flattenedString)) {
|
||||||
ComponentName componentName = ComponentName.unflattenFromString(flattenedString);
|
ComponentName componentName = ComponentName.unflattenFromString(flattenedString);
|
||||||
@@ -200,6 +217,7 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
|||||||
if (mResultIntent != null) {
|
if (mResultIntent != null) {
|
||||||
intent.putExtras(mResultIntent);
|
intent.putExtras(mResultIntent);
|
||||||
}
|
}
|
||||||
|
mNextClicked = true;
|
||||||
WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent);
|
WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent);
|
||||||
startActivityForResult(intent, BIOMETRIC_FIND_SENSOR_REQUEST);
|
startActivityForResult(intent, BIOMETRIC_FIND_SENSOR_REQUEST);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,16 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
|
||||||
|
if (!isChangingConfigurations() && !mConfirmingCredentials && !mNextClicked
|
||||||
|
&& !WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isDisabledByAdmin() {
|
protected boolean isDisabledByAdmin() {
|
||||||
return RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled(
|
return RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled(
|
||||||
|
|||||||
@@ -123,8 +123,10 @@ public class FaceSettings extends DashboardFragment {
|
|||||||
Preference appPref = findPreference(FaceSettingsAppPreferenceController.KEY);
|
Preference appPref = findPreference(FaceSettingsAppPreferenceController.KEY);
|
||||||
Preference attentionPref = findPreference(FaceSettingsAttentionPreferenceController.KEY);
|
Preference attentionPref = findPreference(FaceSettingsAttentionPreferenceController.KEY);
|
||||||
Preference confirmPref = findPreference(FaceSettingsConfirmPreferenceController.KEY);
|
Preference confirmPref = findPreference(FaceSettingsConfirmPreferenceController.KEY);
|
||||||
|
Preference bypassPref =
|
||||||
|
findPreference(FaceSettingsLockscreenBypassPreferenceController.KEY);
|
||||||
mTogglePreferences = new ArrayList<>(
|
mTogglePreferences = new ArrayList<>(
|
||||||
Arrays.asList(keyguardPref, appPref, attentionPref, confirmPref));
|
Arrays.asList(keyguardPref, appPref, attentionPref, confirmPref, bypassPref));
|
||||||
|
|
||||||
mRemoveButton = findPreference(FaceSettingsRemoveButtonPreferenceController.KEY);
|
mRemoveButton = findPreference(FaceSettingsRemoveButtonPreferenceController.KEY);
|
||||||
mEnrollButton = findPreference(FaceSettingsEnrollButtonPreferenceController.KEY);
|
mEnrollButton = findPreference(FaceSettingsEnrollButtonPreferenceController.KEY);
|
||||||
@@ -142,6 +144,7 @@ public class FaceSettings extends DashboardFragment {
|
|||||||
// Don't show keyguard controller for work profile settings.
|
// Don't show keyguard controller for work profile settings.
|
||||||
if (mUserManager.isManagedProfile(mUserId)) {
|
if (mUserManager.isManagedProfile(mUserId)) {
|
||||||
removePreference(FaceSettingsKeyguardPreferenceController.KEY);
|
removePreference(FaceSettingsKeyguardPreferenceController.KEY);
|
||||||
|
removePreference(FaceSettingsLockscreenBypassPreferenceController.KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
@@ -248,6 +251,7 @@ public class FaceSettings extends DashboardFragment {
|
|||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||||
controllers.add(new FaceSettingsVideoPreferenceController(context));
|
controllers.add(new FaceSettingsVideoPreferenceController(context));
|
||||||
controllers.add(new FaceSettingsKeyguardPreferenceController(context));
|
controllers.add(new FaceSettingsKeyguardPreferenceController(context));
|
||||||
|
controllers.add(new FaceSettingsLockscreenBypassPreferenceController(context));
|
||||||
controllers.add(new FaceSettingsAppPreferenceController(context));
|
controllers.add(new FaceSettingsAppPreferenceController(context));
|
||||||
controllers.add(new FaceSettingsAttentionPreferenceController(context));
|
controllers.add(new FaceSettingsAttentionPreferenceController(context));
|
||||||
controllers.add(new FaceSettingsRemoveButtonPreferenceController(context));
|
controllers.add(new FaceSettingsRemoveButtonPreferenceController(context));
|
||||||
|
|||||||
@@ -18,16 +18,13 @@ package com.android.settings.biometrics.face;
|
|||||||
|
|
||||||
import static android.provider.Settings.Secure.FACE_UNLOCK_KEYGUARD_ENABLED;
|
import static android.provider.Settings.Secure.FACE_UNLOCK_KEYGUARD_ENABLED;
|
||||||
|
|
||||||
import android.app.admin.DevicePolicyManager;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preference controller for Face settings page controlling the ability to unlock the phone
|
* Preference controller for Face settings page controlling the ability to unlock the phone
|
||||||
@@ -87,13 +84,4 @@ public class FaceSettingsKeyguardPreferenceController extends FaceSettingsPrefer
|
|||||||
preference.setEnabled(true);
|
preference.setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean adminDisabled() {
|
|
||||||
DevicePolicyManager dpm =
|
|
||||||
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
|
||||||
return dpm != null &&
|
|
||||||
(dpm.getKeyguardDisabledFeatures(null, UserHandle.myUserId())
|
|
||||||
& DevicePolicyManager.KEYGUARD_DISABLE_FACE)
|
|
||||||
!= 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,25 +11,33 @@
|
|||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.settings.security;
|
package com.android.settings.biometrics.face;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import androidx.preference.Preference;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
|
||||||
|
|
||||||
public class LockscreenBypassPreferenceController extends TogglePreferenceController {
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
|
|
||||||
|
public class FaceSettingsLockscreenBypassPreferenceController
|
||||||
|
extends FaceSettingsPreferenceController {
|
||||||
|
|
||||||
|
static final String KEY = "security_lockscreen_bypass";
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected FaceManager mFaceManager;
|
protected FaceManager mFaceManager;
|
||||||
|
|
||||||
public LockscreenBypassPreferenceController(Context context, String preferenceKey) {
|
public FaceSettingsLockscreenBypassPreferenceController(Context context) {
|
||||||
|
this(context, KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FaceSettingsLockscreenBypassPreferenceController(Context context, String preferenceKey) {
|
||||||
super(context, preferenceKey);
|
super(context, preferenceKey);
|
||||||
if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
|
if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
|
||||||
mFaceManager = context.getSystemService(FaceManager.class);
|
mFaceManager = context.getSystemService(FaceManager.class);
|
||||||
@@ -51,6 +59,20 @@ public class LockscreenBypassPreferenceController extends TogglePreferenceContro
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateState(Preference preference) {
|
||||||
|
super.updateState(preference);
|
||||||
|
if (!FaceSettings.isAvailable(mContext)) {
|
||||||
|
preference.setEnabled(false);
|
||||||
|
} else if (adminDisabled()) {
|
||||||
|
preference.setEnabled(false);
|
||||||
|
} else if (!mFaceManager.hasEnrolledTemplates(getUserId())) {
|
||||||
|
preference.setEnabled(false);
|
||||||
|
} else {
|
||||||
|
preference.setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
if (mFaceManager != null && mFaceManager.isHardwareDetected()) {
|
if (mFaceManager != null && mFaceManager.isHardwareDetected()) {
|
||||||
@@ -16,7 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings.biometrics.face;
|
package com.android.settings.biometrics.face;
|
||||||
|
|
||||||
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
|
|
||||||
@@ -38,4 +40,13 @@ public abstract class FaceSettingsPreferenceController extends TogglePreferenceC
|
|||||||
protected int getUserId() {
|
protected int getUserId() {
|
||||||
return mUserId;
|
return mUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean adminDisabled() {
|
||||||
|
DevicePolicyManager dpm =
|
||||||
|
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||||
|
return dpm != null &&
|
||||||
|
(dpm.getKeyguardDisabledFeatures(null, UserHandle.myUserId())
|
||||||
|
& DevicePolicyManager.KEYGUARD_DISABLE_FACE)
|
||||||
|
!= 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -480,7 +480,6 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
|||||||
controllers.add(new ResizableActivityPreferenceController(context));
|
controllers.add(new ResizableActivityPreferenceController(context));
|
||||||
controllers.add(new FreeformWindowsPreferenceController(context));
|
controllers.add(new FreeformWindowsPreferenceController(context));
|
||||||
controllers.add(new DesktopModePreferenceController(context));
|
controllers.add(new DesktopModePreferenceController(context));
|
||||||
controllers.add(new DeviceIdentifierAccessRestrictionsPreferenceController(context));
|
|
||||||
controllers.add(new ShortcutManagerThrottlingPreferenceController(context));
|
controllers.add(new ShortcutManagerThrottlingPreferenceController(context));
|
||||||
controllers.add(new BubbleGlobalPreferenceController(context));
|
controllers.add(new BubbleGlobalPreferenceController(context));
|
||||||
controllers.add(new EnableGnssRawMeasFullTrackingPreferenceController(context));
|
controllers.add(new EnableGnssRawMeasFullTrackingPreferenceController(context));
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.development;
|
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.provider.DeviceConfig;
|
|
||||||
import android.provider.Settings;
|
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
|
||||||
import androidx.preference.SwitchPreference;
|
|
||||||
|
|
||||||
import com.android.settings.Utils;
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
|
||||||
|
|
||||||
public class DeviceIdentifierAccessRestrictionsPreferenceController
|
|
||||||
extends DeveloperOptionsPreferenceController
|
|
||||||
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
|
|
||||||
|
|
||||||
private static final String DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_KEY =
|
|
||||||
"device_identifier_access_restrictions";
|
|
||||||
|
|
||||||
// The settings that should be set when the new device identifier access restrictions are
|
|
||||||
// disabled.
|
|
||||||
private static final String[] RELAX_DEVICE_IDENTIFIER_CHECK_SETTINGS = {
|
|
||||||
Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_3P_CHECK_RELAXED,
|
|
||||||
Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_NON_PRIV_CHECK_RELAXED,
|
|
||||||
Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_PRIV_CHECK_RELAXED
|
|
||||||
};
|
|
||||||
|
|
||||||
private ContentResolver mContentResolver;
|
|
||||||
|
|
||||||
public DeviceIdentifierAccessRestrictionsPreferenceController(Context context) {
|
|
||||||
super(context);
|
|
||||||
mContentResolver = context.getContentResolver();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAvailable() {
|
|
||||||
// If the new access restrictions have been disabled from the server side then do not
|
|
||||||
// display the option.
|
|
||||||
boolean disabledFromServerSide = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
|
|
||||||
Utils.PROPERTY_DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_DISABLED, false);
|
|
||||||
return !disabledFromServerSide;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPreferenceKey() {
|
|
||||||
return DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_KEY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
||||||
writeSetting((boolean) newValue);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeSetting(boolean isEnabled) {
|
|
||||||
for (String relaxCheckSetting : RELAX_DEVICE_IDENTIFIER_CHECK_SETTINGS) {
|
|
||||||
Settings.Global.putInt(mContentResolver, relaxCheckSetting, isEnabled ? 1 : 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateState(Preference preference) {
|
|
||||||
boolean isEnabled = true;
|
|
||||||
for (String relaxCheckSetting : RELAX_DEVICE_IDENTIFIER_CHECK_SETTINGS) {
|
|
||||||
if (Settings.Global.getInt(mContentResolver, relaxCheckSetting, 0) == 0) {
|
|
||||||
isEnabled = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
|
||||||
writeSetting(false);
|
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License
|
* limitations under the License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.settings.security;
|
package com.android.settings.biometrics.face;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@@ -36,14 +36,14 @@ import org.robolectric.RuntimeEnvironment;
|
|||||||
import org.robolectric.util.ReflectionHelpers;
|
import org.robolectric.util.ReflectionHelpers;
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public class LockscreenBypassPreferenceControllerTest {
|
public class FaceSettingsLockscreenBypassPreferenceControllerTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private FaceManager mFaceManager;
|
private FaceManager mFaceManager;
|
||||||
private SwitchPreference mPreference;
|
private SwitchPreference mPreference;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private LockscreenBypassPreferenceController mController;
|
private FaceSettingsLockscreenBypassPreferenceController mController;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
@@ -51,7 +51,7 @@ public class LockscreenBypassPreferenceControllerTest {
|
|||||||
mContext = RuntimeEnvironment.application;
|
mContext = RuntimeEnvironment.application;
|
||||||
mPreference = new SwitchPreference(mContext);
|
mPreference = new SwitchPreference(mContext);
|
||||||
|
|
||||||
mController = new LockscreenBypassPreferenceController(mContext, "TestKey");
|
mController = new FaceSettingsLockscreenBypassPreferenceController(mContext);
|
||||||
ReflectionHelpers.setField(mController, "mFaceManager", mFaceManager);
|
ReflectionHelpers.setField(mController, "mFaceManager", mFaceManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user