Add flag guard to isPrivateProfile() API

Bug: 303726780
Change-Id: I3023c440e398d99676b4e9388afd4294b29a083e
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 03a58be..7cb2108 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -1085,7 +1085,7 @@
     method public boolean isMain();
     method public boolean isManagedProfile();
     method @Deprecated public boolean isPrimary();
-    method public boolean isPrivateProfile();
+    method @FlaggedApi("android.os.allow_private_profile") public boolean isPrivateProfile();
     method public boolean isProfile();
     method public boolean isQuietModeEnabled();
     method public boolean isRestricted();
diff --git a/core/java/android/content/pm/UserInfo.java b/core/java/android/content/pm/UserInfo.java
index 9f4459d..be586c3 100644
--- a/core/java/android/content/pm/UserInfo.java
+++ b/core/java/android/content/pm/UserInfo.java
@@ -16,6 +16,9 @@
 
 package android.content.pm;
 
+import static android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE;
+
+import android.annotation.FlaggedApi;
 import android.annotation.IntDef;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
@@ -390,6 +393,7 @@
         return UserManager.isUserTypeCommunalProfile(userType);
     }
 
+    @FlaggedApi(FLAG_ALLOW_PRIVATE_PROFILE)
     public boolean isPrivateProfile() {
         return UserManager.isUserTypePrivateProfile(userType);
     }