Add an additional flag guard for Private Space implementation

This a layer of flag guarding only for the implementation of Private Space features excluding the APIs. The MVP flag allow_private_profile still guards all the features including the APIs.

Bug: 326060689
Test: Manual - a few verifications that some feeatures are unavailable when this flag is disabled
Test: Run presubmits and verify that nothing breaks
Change-Id: I05f7e2f20c6132b33484bb133ce03a933ece485f
This commit is contained in:
Olivier Nshimiye
2024-02-26 11:23:08 +00:00
parent 71c6c3e557
commit 0f3799cbad
40 changed files with 109 additions and 42 deletions

View File

@@ -78,7 +78,8 @@ public class PrivateSpaceMaintainer {
*/
@VisibleForTesting
public final synchronized boolean createPrivateSpace() {
if (!Flags.allowPrivateProfile()) {
if (!Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return false;
}
// Check if Private space already exists
@@ -146,7 +147,8 @@ public class PrivateSpaceMaintainer {
/** Returns true if the Private space exists. */
public synchronized boolean doesPrivateSpaceExist() {
if (!Flags.allowPrivateProfile()) {
if (!Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return false;
}
if (mUserHandle != null) {
@@ -322,6 +324,7 @@ public class PrivateSpaceMaintainer {
private boolean isPrivateSpaceAutoLockSupported() {
return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.supportAutolockForPrivateSpace();
&& android.multiuser.Flags.supportAutolockForPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures();
}
}