Put stricter flag checks

Also removed a log which gives away flag.

Bug: 312976400
Test: manual
Change-Id: I4a989de8b6b920666aabf0cc9311e28becc4d862
This commit is contained in:
Manish Singh
2023-11-23 23:23:20 +00:00
parent f403dc9c79
commit 51f1321b1e
18 changed files with 61 additions and 10 deletions

View File

@@ -25,6 +25,7 @@ import android.app.KeyguardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.UserInfo;
import android.os.Flags;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
@@ -68,6 +69,9 @@ public class PrivateSpaceMaintainer {
* <p> This method should be used by the Private Space Setup Flow ONLY.
*/
final synchronized boolean createPrivateSpace() {
if (!Flags.allowPrivateProfile()) {
return false;
}
// Check if Private space already exists
if (doesPrivateSpaceExist()) {
return true;
@@ -130,6 +134,9 @@ public class PrivateSpaceMaintainer {
/** Returns true if the Private space exists. */
public synchronized boolean doesPrivateSpaceExist() {
if (!Flags.allowPrivateProfile()) {
return false;
}
if (mUserHandle != null) {
return true;
}