Merge "Cache attention toggle in settings" into qt-dev

am: 13c1c27b8c

Change-Id: If7add23abcfcbdbe77886d7d7716763f91008df7
This commit is contained in:
Kevin Chyn
2019-04-04 23:52:52 -07:00
committed by android-build-merger

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import android.hardware.face.FaceManager; import android.hardware.face.FaceManager;
import android.hardware.face.FaceManager.GetFeatureCallback; import android.hardware.face.FaceManager.GetFeatureCallback;
import android.hardware.face.FaceManager.SetFeatureCallback; import android.hardware.face.FaceManager.SetFeatureCallback;
import android.provider.Settings;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference; import androidx.preference.SwitchPreference;
@@ -46,6 +47,10 @@ public class FaceSettingsAttentionPreferenceController extends FaceSettingsPrefe
mPreference.setEnabled(true); mPreference.setEnabled(true);
if (!success) { if (!success) {
mPreference.setChecked(!mPreference.isChecked()); mPreference.setChecked(!mPreference.isChecked());
} else {
Settings.Secure.putIntForUser(mContext.getContentResolver(),
Settings.Secure.FACE_UNLOCK_ATTENTION_REQUIRED,
mPreference.isChecked() ? 1 : 0, getUserId());
} }
} }
} }