Create a mechanism to allow OEM config posture guidance with
'config_face_enroll_guidance_page', and customize the config
'config_face_enroll_supported_posture' with standard postures
0 : DEVICE_POSTURE_UNKNOWN
1 : DEVICE_POSTURE_CLOSED
2 : DEVICE_POSTURE_HALF_OPENED
3 : DEVICE_POSTURE_OPENED
4 : DEVICE_POSTURE_FLIPPED
For example, if we set 1 for the device, then device only
allow to enroll face in closed(folded) state, if device do
not in the allow state, we will prompt specific guidance
page activity defined in config_face_enroll_guidance_page.
At this stage , we only integrate 2 states OPENED/CLOSED through
ScreenSizeFoldProvider and register for onFoldUpdated() callback
- isFold(DEVICE_POSTURE_CLOSED): finish posture guidance
- !isFold(DEVICE_POSTURE_OPENED): launch posture guidance
- onActivityResult : reset mOnGuidanceShown false
1. Fix A11y lottie animation bug
2. Impl FoldProvider.FoldCallback
3. Register callback to ScreenSizeFoldProvider
4. Integrate back stack, skip, cancel events
- Back key : RESULT_CANCELED
- Skip btn : RESULT_SKIP
- Posture changed : RESULT_FINISHED
5. Set single instance for relative activities
6. FaceEnrollFoldPage listen for onConfigurationChanged()
7. Add empty face_posture_guidance_lottie.json for overlay
Test: atest SettingsGoogleUnitTests
Test: m -j SettingsGoogleRoboTests RunSettingsGoogleRoboTests
Test: m RunSettingsRoboTests ROBOTEST_FILTER= \
"com.android.settings.biometrics.face.FaceEnrollEducationTest"
Test: m RunSettingsRoboTests ROBOTEST_FILTER= \
"com.android.settings.biometrics.face.FaceEnrollIntroductionTest"
Test: Manual launch security settings face enroll, unfold device
and observe posture guidance showing fullscreen on top
Test: Fold device ensure the posture guidance activity finish
Bug: 261141826
Fixes: 231908496
Change-Id: Ib9f43f82f7d19f3f187c2f6f8984e76cd843afbc
64 lines
2.0 KiB
Java
64 lines
2.0 KiB
Java
/*
|
|
* 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.biometrics.face;
|
|
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.text.TextUtils;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
|
|
import com.android.settings.R;
|
|
|
|
public class FaceFeatureProviderImpl implements FaceFeatureProvider {
|
|
|
|
/**
|
|
* Returns the guidance page intent if device support {@link FoldingFeature}, and we want to
|
|
* guide user enrolling faces with specific device posture.
|
|
*
|
|
* @param context the application context
|
|
* @return the posture guidance intent, otherwise null if device not support
|
|
*/
|
|
@Nullable
|
|
@Override
|
|
public Intent getPostureGuidanceIntent(Context context) {
|
|
final String flattenedString = context.getString(R.string.config_face_enroll_guidance_page);
|
|
final Intent intent;
|
|
if (!TextUtils.isEmpty(flattenedString)) {
|
|
ComponentName componentName = ComponentName.unflattenFromString(flattenedString);
|
|
if (componentName != null) {
|
|
intent = new Intent();
|
|
intent.setComponent(componentName);
|
|
return intent;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public boolean isAttentionSupported(Context context) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isSetupWizardSupported(@NonNull Context context) {
|
|
return true;
|
|
}
|
|
}
|