Show a dialog preventing face enrollment in split mode.

Test: atest CombinedBiometricProfileSettingsTest
Test: atest FingerprintSettingsFragmentTest
Test: manaul test- go to split screen mode and try to enroll
face
Bug: 276938441

Change-Id: I45e859b453700aa79f7774fb5deda81b1f30e5a5
This commit is contained in:
Hao Dong
2023-04-04 19:50:26 +00:00
parent 8930e6ea87
commit 64277a23bb
9 changed files with 314 additions and 146 deletions

View File

@@ -0,0 +1,80 @@
/*
* Copyright (C) 2023 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 static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.widget.Button;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
@RunWith(AndroidJUnit4.class)
public class FaceSettingsEnrollButtonPreferenceControllerTest {
@Rule
public final MockitoRule mMockitoRule = MockitoJUnit.rule();
@Mock
private Context mContext;
@Mock
private Button mButton;
@Mock
private FaceSettingsEnrollButtonPreferenceController.Listener mListener;
private FaceSettingsEnrollButtonPreferenceController mController;
@Before
public void setUp() {
mController = new FaceSettingsEnrollButtonPreferenceController(mContext);
mController.setListener(mListener);
}
@Test
public void isSliceable_returnFalse() {
assertThat(mController.isSliceable()).isFalse();
}
@Test
public void testOnClick_inFullScreen() {
when(mListener.checkInMultiWindowMode()).thenReturn(false);
mController.onClick(mButton);
assertThat(mController.isClicked()).isTrue();
verify(mListener).onStartEnrolling(any());
}
@Test
public void testOnClick_inMultiWindow() {
when(mListener.checkInMultiWindowMode()).thenReturn(true);
mController.onClick(mButton);
assertThat(mController.isClicked()).isFalse();
verify(mListener, never()).onStartEnrolling(any());
}
}