Private space auto lock on device restart during setup

After creation of private space value of auto-lock setting is explicitly
set to lock on device restarts. Just before the end of the setup flow
the auto-lock setting is changed to auto-lock on device lock before the
last screen of private space setup.

Bug: 342398315
Test: atest PrivateSpaceMaintainerTest
Change-Id: I8eeb0058c7ecb31d6e30b4cc78ec5877ed316f75
This commit is contained in:
josephpv
2024-05-28 13:26:41 +00:00
parent a848c57633
commit 7ef9c46afa
3 changed files with 18 additions and 6 deletions

View File

@@ -19,6 +19,8 @@ package com.android.settings.privatespace;
import static android.content.Intent.ACTION_PROFILE_INACCESSIBLE;
import static android.content.Intent.ACTION_PROFILE_UNAVAILABLE;
import static com.android.settings.privatespace.PrivateSpaceMaintainer.PRIVATE_SPACE_AUTO_LOCK_DEFAULT_VAL;
import android.app.settings.SettingsEnums;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -101,8 +103,13 @@ public class SetupPreFinishDelayFragment extends InstrumentedFragment {
};
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
if (savedInstanceState == null) {
// TODO(b/307729746): Add a test to verify PS is locked after setup completion.
PrivateSpaceMaintainer.getInstance(getActivity()).lockPrivateSpace();
// TODO(b/307729746): Add test to verify PS is locked and auto-lock value is set to
// auto-lock on device lock after setup completion.
PrivateSpaceMaintainer privateSpaceMaintainer =
PrivateSpaceMaintainer.getInstance(getActivity());
privateSpaceMaintainer.setPrivateSpaceAutoLockSetting(
PRIVATE_SPACE_AUTO_LOCK_DEFAULT_VAL);
privateSpaceMaintainer.lockPrivateSpace();
}
return rootView;
}