summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SafetyCenter/Config/tests/java/com/android/safetycenter/config/ParserConfigValidTest.kt9
-rw-r--r--framework-s/java/android/safetycenter/config/SafetySource.java14
-rw-r--r--tests/cts/safetycenter/src/android/safetycenter/cts/config/SafetySourceTest.kt7
3 files changed, 18 insertions, 12 deletions
diff --git a/SafetyCenter/Config/tests/java/com/android/safetycenter/config/ParserConfigValidTest.kt b/SafetyCenter/Config/tests/java/com/android/safetycenter/config/ParserConfigValidTest.kt
index 5e8d04597..133f4ce73 100644
--- a/SafetyCenter/Config/tests/java/com/android/safetycenter/config/ParserConfigValidTest.kt
+++ b/SafetyCenter/Config/tests/java/com/android/safetycenter/config/ParserConfigValidTest.kt
@@ -23,6 +23,7 @@ import android.safetycenter.config.SafetySourcesGroup
import androidx.test.core.app.ApplicationProvider.getApplicationContext
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.modules.utils.build.SdkLevel
+import com.android.permission.flags.Flags
import com.android.safetycenter.config.tests.R
import com.google.common.truth.Truth.assertThat
import org.junit.Test
@@ -77,7 +78,7 @@ class ParserConfigValidTest {
addPackageCertificateHash("feed1")
addPackageCertificateHash("feed2")
}
- if (SdkLevel.isAtLeastV()) {
+ if (SdkLevel.isAtLeastV() && Flags.privateProfileTitleApi()) {
setTitleForPrivateProfileResId(R.string.reference)
}
}
@@ -104,7 +105,7 @@ class ParserConfigValidTest {
addPackageCertificateHash("feed1")
addPackageCertificateHash("feed2")
}
- if (SdkLevel.isAtLeastV()) {
+ if (SdkLevel.isAtLeastV() && Flags.privateProfileTitleApi()) {
setTitleForPrivateProfileResId(R.string.reference)
}
}
@@ -140,7 +141,7 @@ class ParserConfigValidTest {
.setInitialDisplayState(SafetySource.INITIAL_DISPLAY_STATE_HIDDEN)
.setSearchTermsResId(R.string.reference)
.apply {
- if (SdkLevel.isAtLeastV()) {
+ if (SdkLevel.isAtLeastV() && Flags.privateProfileTitleApi()) {
setTitleForPrivateProfileResId(R.string.reference)
}
}
@@ -171,7 +172,7 @@ class ParserConfigValidTest {
.setProfile(SafetySource.PROFILE_ALL)
.setSearchTermsResId(R.string.reference)
.apply {
- if (SdkLevel.isAtLeastV()) {
+ if (SdkLevel.isAtLeastV() && Flags.privateProfileTitleApi()) {
setTitleForPrivateProfileResId(R.string.reference)
}
}
diff --git a/framework-s/java/android/safetycenter/config/SafetySource.java b/framework-s/java/android/safetycenter/config/SafetySource.java
index 5502ca950..ff0c66e24 100644
--- a/framework-s/java/android/safetycenter/config/SafetySource.java
+++ b/framework-s/java/android/safetycenter/config/SafetySource.java
@@ -808,18 +808,18 @@ public final class SafetySource implements Parcelable {
}
/**
- * Sets the resource id of the title for work of this safety source.
+ * Sets the resource id of the title for private profile of this safety source.
*
* <p>The id must refer to a string resource that is either accessible from any resource
* context or that is accessible from the same resource context that was used to load the
* Safety Center configuration. The id defaults to {@link Resources#ID_NULL} when a title
- * for work is not provided.
+ * for private profile is not provided.
*
- * <p>The title for work is required if the profile property of the source is set to {@link
- * SafetySource#PROFILE_ALL} and either the source is of type static or the source is a
- * source of type dynamic that is not hidden and that does not provide search terms. The
- * title for work is prohibited for sources of type issue-only and if the profile property
- * of the source is not set to {@link SafetySource#PROFILE_ALL}.
+ * <p>The title for private profile is required if the profile property of the source is set
+ * to {@link SafetySource#PROFILE_ALL} and either the source is of type static or the source
+ * is a source of type dynamic that is not hidden and that does not provide search terms.
+ * The title for private profile is prohibited for sources of type issue-only and if the
+ * profile property of the source is not set to {@link SafetySource#PROFILE_ALL}.
*/
@FlaggedApi(Flags.FLAG_PRIVATE_PROFILE_TITLE_API)
@RequiresApi(VANILLA_ICE_CREAM)
diff --git a/tests/cts/safetycenter/src/android/safetycenter/cts/config/SafetySourceTest.kt b/tests/cts/safetycenter/src/android/safetycenter/cts/config/SafetySourceTest.kt
index c5c5c218d..4b6f0f6f9 100644
--- a/tests/cts/safetycenter/src/android/safetycenter/cts/config/SafetySourceTest.kt
+++ b/tests/cts/safetycenter/src/android/safetycenter/cts/config/SafetySourceTest.kt
@@ -19,6 +19,7 @@ package android.safetycenter.cts.config
import android.content.res.Resources
import android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE
import android.os.Build.VERSION_CODES.VANILLA_ICE_CREAM
+import android.platform.test.annotations.RequiresFlagsEnabled
import android.safetycenter.config.SafetySource
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.ext.truth.os.ParcelableSubject.assertThat
@@ -128,9 +129,13 @@ class SafetySourceTest {
}
}
- @SdkSuppress(minSdkVersion = VANILLA_ICE_CREAM)
+ @RequiresFlagsEnabled(Flags.FLAG_PRIVATE_PROFILE_TITLE_API)
+ @SdkSuppress(minSdkVersion = VANILLA_ICE_CREAM, codeName = "VanillaIceCream")
@Test
fun getTitleForPrivateProfileResId_returnsTitleForPrivateProfileResIdOrThrows() {
+ if (!Flags.privateProfileTitleApi()) {
+ return
+ }
assertThrows(UnsupportedOperationException::class.java) {
DYNAMIC_BAREBONE.titleForPrivateProfileResId
}