Start private space setup when there is no private space set
This change handles as below based on if private space already exists on device: 1. If PS doesn't exist then start the setup flow which shows a PS education screen. On setup button creates the private space. 2. If PS already exists on device then display PS settings page. Bug: 299069146 Test: atest PrivateSpaceSettingsAuthenticatorTest Change-Id: I46bdbaeb0210fd5b41a426f852e3f455b62c1c29
This commit is contained in:
@@ -16,14 +16,13 @@
|
||||
|
||||
package com.android.settings.privatespace;
|
||||
|
||||
import static com.android.settings.privatespace.PrivateSpaceSafetySource.SAFETY_SOURCE_ID;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -86,13 +85,17 @@ public class PrivateSpaceAuthenticationActivityTest {
|
||||
mPrivateSpaceAuthenticationActivity.setPrivateSpaceMaintainer(injector);
|
||||
}
|
||||
|
||||
/** Tests that on lock authentication Private space settings is launched. */
|
||||
/** Tests that when Private does not exist setup flow is started. */
|
||||
//TODO(b/307729746) Plan to add more tests for complete setup flow
|
||||
@Test
|
||||
@RequiresFlagsEnabled(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
|
||||
public void deviceSecurePrivateSpaceExists() {
|
||||
public void whenPrivateProfileDoesNotExist_triggersSetupFlow() {
|
||||
when(mPrivateSpaceMaintainer.doesPrivateSpaceExist()).thenReturn(false);
|
||||
|
||||
final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
|
||||
mPrivateSpaceAuthenticationActivity.onLockAuthentication(mContext);
|
||||
verify(mPrivateSpaceAuthenticationActivity).startActivity(intentCaptor.capture());
|
||||
assertThat(intentCaptor.getValue().getIdentifier()).isEqualTo(SAFETY_SOURCE_ID);
|
||||
assertThat(intentCaptor.getValue().getComponent().getClassName())
|
||||
.isEqualTo(PrivateSpaceSetupActivity.class.getName());
|
||||
}
|
||||
}
|
||||
|
@@ -138,7 +138,9 @@ public class PrivateSpaceSafetySourceTest {
|
||||
any(), eq(SAFETY_SOURCE_ID), captor.capture(), eq(EVENT_TYPE_DEVICE_REBOOTED));
|
||||
SafetySourceData safetySourceData = captor.getValue();
|
||||
SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
|
||||
assertThat(safetySourceStatus.getPendingIntent().getIntent()
|
||||
.equals(PrivateSpaceAuthenticationActivity.class));
|
||||
assertThat(safetySourceStatus.getPendingIntent().getIntent().getComponent().getClassName())
|
||||
.isEqualTo(PrivateSpaceAuthenticationActivity.class.getName());
|
||||
assertThat(safetySourceStatus.getPendingIntent().getIntent().getIdentifier())
|
||||
.isEqualTo(SAFETY_SOURCE_ID);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user