summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Giulio Fiscella <fiscella@google.com> 2022-03-16 11:22:07 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-03-16 11:22:07 +0000
commit25db69eafed97dd0ff217b5e43e3311235508ca6 (patch)
tree791c6bf9bd10e7b5d2389d61ca86aa95436e9d97
parent49aeec991f527ff50a7d66853d6b14f823a16fe1 (diff)
parent0deae015dc8ed95da38774bd7d3b13528da53b08 (diff)
Merge "Add flag to support automatic notifications from issues for some sources" into tm-dev
-rw-r--r--SafetyCenter/Config/safety_center_config.xsd2
-rw-r--r--framework-s/api/system-current.txt2
-rw-r--r--framework-s/java/android/safetycenter/config/SafetyCenterConfigParser.java7
-rw-r--r--framework-s/java/android/safetycenter/config/SafetySource.java53
-rw-r--r--tests/cts/safetycenter/res/xml/config_static_safety_source_with_notification.xml16
-rw-r--r--tests/cts/safetycenter/res/xml/config_valid.xml6
-rw-r--r--tests/cts/safetycenter/src/android/safetycenter/config/cts/ParserConfigInvalidTest.kt6
-rw-r--r--tests/cts/safetycenter/src/android/safetycenter/config/cts/ParserConfigValidTest.kt2
-rw-r--r--tests/cts/safetycenter/src/android/safetycenter/config/cts/SafetySourceTest.kt56
9 files changed, 138 insertions, 12 deletions
diff --git a/SafetyCenter/Config/safety_center_config.xsd b/SafetyCenter/Config/safety_center_config.xsd
index 77909d341..f4adc4721 100644
--- a/SafetyCenter/Config/safety_center_config.xsd
+++ b/SafetyCenter/Config/safety_center_config.xsd
@@ -72,6 +72,7 @@
<xsd:attribute name="broadcastReceiverClassName" type="xsd:string"/>
<xsd:attribute name="loggingAllowed" type="xsd:boolean" default="true"/>
<xsd:attribute name="refreshOnPageOpenAllowed" type="xsd:boolean" default="false"/>
+ <xsd:attribute name="automaticNotificationFromIssueAllowed" type="xsd:boolean" default="false"/>
</xsd:complexType>
<xsd:complexType name="issue-only-safety-source">
@@ -83,6 +84,7 @@
<xsd:attribute name="broadcastReceiverClassName" type="xsd:string"/>
<xsd:attribute name="loggingAllowed" type="xsd:boolean" default="true"/>
<xsd:attribute name="refreshOnPageOpenAllowed" type="xsd:boolean" default="false"/>
+ <xsd:attribute name="automaticNotificationFromIssueAllowed" type="xsd:boolean" default="false"/>
</xsd:complexType>
<xsd:complexType name="static-safety-source">
diff --git a/framework-s/api/system-current.txt b/framework-s/api/system-current.txt
index 764c3774f..ecf36e9c0 100644
--- a/framework-s/api/system-current.txt
+++ b/framework-s/api/system-current.txt
@@ -446,6 +446,7 @@ package android.safetycenter.config {
method @StringRes public int getTitleForWorkResId();
method @StringRes public int getTitleResId();
method public int getType();
+ method public boolean isAutomaticNotificationFromIssueAllowed();
method public boolean isLoggingAllowed();
method public boolean isRefreshOnPageOpenAllowed();
method public void writeToParcel(@NonNull android.os.Parcel, int);
@@ -464,6 +465,7 @@ package android.safetycenter.config {
public static final class SafetySource.Builder {
ctor public SafetySource.Builder(int);
method @NonNull public android.safetycenter.config.SafetySource build();
+ method @NonNull public android.safetycenter.config.SafetySource.Builder setAutomaticNotificationFromIssueAllowed(boolean);
method @NonNull public android.safetycenter.config.SafetySource.Builder setBroadcastReceiverClassName(@Nullable String);
method @NonNull public android.safetycenter.config.SafetySource.Builder setId(@Nullable String);
method @NonNull public android.safetycenter.config.SafetySource.Builder setInitialDisplayState(int);
diff --git a/framework-s/java/android/safetycenter/config/SafetyCenterConfigParser.java b/framework-s/java/android/safetycenter/config/SafetyCenterConfigParser.java
index 75ca73758..304e17a72 100644
--- a/framework-s/java/android/safetycenter/config/SafetyCenterConfigParser.java
+++ b/framework-s/java/android/safetycenter/config/SafetyCenterConfigParser.java
@@ -74,6 +74,8 @@ final class SafetyCenterConfigParser {
private static final String ATTR_SAFETY_SOURCE_LOGGING_ALLOWED = "loggingAllowed";
private static final String ATTR_SAFETY_SOURCE_REFRESH_ON_PAGE_OPEN_ALLOWED =
"refreshOnPageOpenAllowed";
+ private static final String ATTR_SAFETY_SOURCE_AUTOMATIC_NOTIFICATION_FROM_ISSUE_ALLOWED =
+ "automaticNotificationFromIssueAllowed";
private static final String ENUM_STATELESS_ICON_TYPE_NONE = "none";
private static final String ENUM_STATELESS_ICON_TYPE_PRIVACY = "privacy";
@@ -241,6 +243,11 @@ final class SafetyCenterConfigParser {
parseBoolean(parser.getAttributeValue(i), name,
parser.getAttributeName(i)));
break;
+ case ATTR_SAFETY_SOURCE_AUTOMATIC_NOTIFICATION_FROM_ISSUE_ALLOWED:
+ builder.setAutomaticNotificationFromIssueAllowed(
+ parseBoolean(parser.getAttributeValue(i), name,
+ parser.getAttributeName(i)));
+ break;
default:
throwAttributeUnexpected(name, parser.getAttributeName(i));
}
diff --git a/framework-s/java/android/safetycenter/config/SafetySource.java b/framework-s/java/android/safetycenter/config/SafetySource.java
index 2ed746374..36dfb0fa0 100644
--- a/framework-s/java/android/safetycenter/config/SafetySource.java
+++ b/framework-s/java/android/safetycenter/config/SafetySource.java
@@ -141,6 +141,7 @@ public final class SafetySource implements Parcelable {
private final String mBroadcastReceiverClassName;
private final boolean mLoggingAllowed;
private final boolean mRefreshOnPageOpenAllowed;
+ private final boolean mAutomaticNotificationFromIssueAllowed;
/** Returns the id of this safety source. */
private SafetySource(
@@ -157,7 +158,8 @@ public final class SafetySource implements Parcelable {
@StringRes int searchTermsResId,
@Nullable String broadcastReceiverClassName,
boolean loggingAllowed,
- boolean refreshOnPageOpenAllowed) {
+ boolean refreshOnPageOpenAllowed,
+ boolean automaticNotificationFromIssueAllowed) {
mType = type;
mId = id;
mPackageName = packageName;
@@ -172,6 +174,7 @@ public final class SafetySource implements Parcelable {
mBroadcastReceiverClassName = broadcastReceiverClassName;
mLoggingAllowed = loggingAllowed;
mRefreshOnPageOpenAllowed = refreshOnPageOpenAllowed;
+ mAutomaticNotificationFromIssueAllowed = automaticNotificationFromIssueAllowed;
}
/** Returns the type of this safety source. */
@@ -310,6 +313,15 @@ public final class SafetySource implements Parcelable {
return mRefreshOnPageOpenAllowed;
}
+ /** Returns the automatic notification from issue allowed property of this safety source. */
+ public boolean isAutomaticNotificationFromIssueAllowed() {
+ if (mType == SAFETY_SOURCE_TYPE_STATIC) {
+ throw new UnsupportedOperationException(
+ "automaticNotificationFromIssueAllowed unsupported for static safety source");
+ }
+ return mAutomaticNotificationFromIssueAllowed;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -328,7 +340,9 @@ public final class SafetySource implements Parcelable {
&& mSearchTermsResId == that.mSearchTermsResId
&& Objects.equals(mBroadcastReceiverClassName, that.mBroadcastReceiverClassName)
&& mLoggingAllowed == that.mLoggingAllowed
- && mRefreshOnPageOpenAllowed == that.mRefreshOnPageOpenAllowed;
+ && mRefreshOnPageOpenAllowed == that.mRefreshOnPageOpenAllowed
+ && mAutomaticNotificationFromIssueAllowed
+ == that.mAutomaticNotificationFromIssueAllowed;
}
@Override
@@ -336,7 +350,7 @@ public final class SafetySource implements Parcelable {
return Objects.hash(mType, mId, mPackageName, mTitleResId, mTitleForWorkResId,
mSummaryResId, mIntentAction, mProfile, mInitialDisplayState, mMaxSeverityLevel,
mSearchTermsResId, mBroadcastReceiverClassName, mLoggingAllowed,
- mRefreshOnPageOpenAllowed);
+ mRefreshOnPageOpenAllowed, mAutomaticNotificationFromIssueAllowed);
}
@Override
@@ -356,6 +370,8 @@ public final class SafetySource implements Parcelable {
+ ", mBroadcastReceiverClassName='" + mBroadcastReceiverClassName + '\''
+ ", mLoggingAllowed=" + mLoggingAllowed
+ ", mRefreshOnPageOpenAllowed=" + mRefreshOnPageOpenAllowed
+ + ", mAutomaticNotificationFromIssueAllowed="
+ + mAutomaticNotificationFromIssueAllowed
+ '}';
}
@@ -380,6 +396,7 @@ public final class SafetySource implements Parcelable {
dest.writeString(mBroadcastReceiverClassName);
dest.writeBoolean(mLoggingAllowed);
dest.writeBoolean(mRefreshOnPageOpenAllowed);
+ dest.writeBoolean(mAutomaticNotificationFromIssueAllowed);
}
@NonNull
@@ -401,6 +418,7 @@ public final class SafetySource implements Parcelable {
.setBroadcastReceiverClassName(in.readString())
.setLoggingAllowed(in.readBoolean())
.setRefreshOnPageOpenAllowed(in.readBoolean())
+ .setAutomaticNotificationFromIssueAllowed(in.readBoolean())
.build();
}
@@ -446,6 +464,8 @@ public final class SafetySource implements Parcelable {
private Boolean mLoggingAllowed;
@Nullable
private Boolean mRefreshOnPageOpenAllowed;
+ @Nullable
+ private Boolean mAutomaticNotificationFromIssueAllowed;
/** Creates a {@link Builder} for a {@link SafetySource}. */
public Builder(@SafetySourceType int type) {
@@ -501,14 +521,14 @@ public final class SafetySource implements Parcelable {
return this;
}
- /** Sets the initial display state of this safety source. */
+ /** Sets the initial display state of this safety source. Defaults to enabled. */
@NonNull
public Builder setInitialDisplayState(@InitialDisplayState int initialDisplayState) {
mInitialDisplayState = initialDisplayState;
return this;
}
- /** Sets the maximum severity level of this safety source. */
+ /** Sets the maximum severity level of this safety source. Defaults to no maximum. */
@NonNull
public Builder setMaxSeverityLevel(int maxSeverityLevel) {
mMaxSeverityLevel = maxSeverityLevel;
@@ -529,20 +549,34 @@ public final class SafetySource implements Parcelable {
return this;
}
- /** Sets the logging allowed property of this safety source. */
+ /** Sets the logging allowed property of this safety source. Defaults to {@code true}. */
@NonNull
public Builder setLoggingAllowed(boolean loggingAllowed) {
mLoggingAllowed = loggingAllowed;
return this;
}
- /** Sets the refresh on page open allowed property of this safety source. */
+ /**
+ * Sets the refresh on page open allowed property of this safety source. Defaults to {@code
+ * false}.
+ */
@NonNull
public Builder setRefreshOnPageOpenAllowed(boolean refreshOnPageOpenAllowed) {
mRefreshOnPageOpenAllowed = refreshOnPageOpenAllowed;
return this;
}
+ /**
+ * Sets the automatic notification from issue allowed property of this safety source.
+ * Defaults to {@code false}.
+ */
+ @NonNull
+ public Builder setAutomaticNotificationFromIssueAllowed(
+ boolean automaticNotificationFromIssueAllowed) {
+ mAutomaticNotificationFromIssueAllowed = automaticNotificationFromIssueAllowed;
+ return this;
+ }
+
/** Creates the {@link SafetySource} defined by this {@link Builder}. */
@NonNull
public SafetySource build() {
@@ -584,10 +618,13 @@ public final class SafetySource implements Parcelable {
false, isStatic, true);
boolean refreshOnPageOpenAllowed = BuilderUtils.validateBoolean(
mRefreshOnPageOpenAllowed, "refreshOnPageOpenAllowed", false, isStatic, false);
+ boolean automaticNotificationFromIssueAllowed = BuilderUtils.validateBoolean(
+ mAutomaticNotificationFromIssueAllowed, "automaticNotificationFromIssueAllowed",
+ false, isStatic, false);
return new SafetySource(mType, mId, mPackageName, titleResId, titleForWorkResId,
summaryResId, mIntentAction, profile, initialDisplayState, maxSeverityLevel,
searchTermsResId, mBroadcastReceiverClassName, loggingAllowed,
- refreshOnPageOpenAllowed);
+ refreshOnPageOpenAllowed, automaticNotificationFromIssueAllowed);
}
}
diff --git a/tests/cts/safetycenter/res/xml/config_static_safety_source_with_notification.xml b/tests/cts/safetycenter/res/xml/config_static_safety_source_with_notification.xml
new file mode 100644
index 000000000..478fabd4d
--- /dev/null
+++ b/tests/cts/safetycenter/res/xml/config_static_safety_source_with_notification.xml
@@ -0,0 +1,16 @@
+<safety-center-config>
+ <safety-sources-config>
+ <safety-sources-group
+ id="id"
+ title="@string/reference"
+ summary="@string/reference">
+ <static-safety-source
+ id="id"
+ title="@string/reference"
+ summary="@string/reference"
+ intentAction="intent"
+ profile="primary_profile_only"
+ automaticNotificationFromIssueAllowed="true"/>
+ </safety-sources-group>
+ </safety-sources-config>
+</safety-center-config>
diff --git a/tests/cts/safetycenter/res/xml/config_valid.xml b/tests/cts/safetycenter/res/xml/config_valid.xml
index e2f9e7703..e25135b41 100644
--- a/tests/cts/safetycenter/res/xml/config_valid.xml
+++ b/tests/cts/safetycenter/res/xml/config_valid.xml
@@ -25,7 +25,8 @@
searchTerms="@string/reference"
broadcastReceiverClassName="broadcast"
loggingAllowed="false"
- refreshOnPageOpenAllowed="true"/>
+ refreshOnPageOpenAllowed="true"
+ automaticNotificationFromIssueAllowed="true"/>
<dynamic-safety-source
id="dynamic_disabled"
packageName="package"
@@ -70,7 +71,8 @@
maxSeverityLevel="300"
broadcastReceiverClassName="broadcast"
loggingAllowed="false"
- refreshOnPageOpenAllowed="true"/>
+ refreshOnPageOpenAllowed="true"
+ automaticNotificationFromIssueAllowed="true"/>
</safety-sources-group>
<safety-sources-group
id="mixed"
diff --git a/tests/cts/safetycenter/src/android/safetycenter/config/cts/ParserConfigInvalidTest.kt b/tests/cts/safetycenter/src/android/safetycenter/config/cts/ParserConfigInvalidTest.kt
index 354587d58..0ef65ac20 100644
--- a/tests/cts/safetycenter/src/android/safetycenter/config/cts/ParserConfigInvalidTest.kt
+++ b/tests/cts/safetycenter/src/android/safetycenter/config/cts/ParserConfigInvalidTest.kt
@@ -357,6 +357,12 @@ class ParserConfigInvalidTest {
"Prohibited attribute loggingAllowed present"
),
Params(
+ "ConfigStaticSafetySourceWithNotification",
+ R.xml.config_static_safety_source_with_notification,
+ "Element static-safety-source invalid",
+ "Prohibited attribute automaticNotificationFromIssueAllowed present"
+ ),
+ Params(
"ConfigStaticSafetySourceWithPackage",
R.xml.config_static_safety_source_with_package,
"Element static-safety-source invalid",
diff --git a/tests/cts/safetycenter/src/android/safetycenter/config/cts/ParserConfigValidTest.kt b/tests/cts/safetycenter/src/android/safetycenter/config/cts/ParserConfigValidTest.kt
index 87ed2fe4c..299f7d9e7 100644
--- a/tests/cts/safetycenter/src/android/safetycenter/config/cts/ParserConfigValidTest.kt
+++ b/tests/cts/safetycenter/src/android/safetycenter/config/cts/ParserConfigValidTest.kt
@@ -65,6 +65,7 @@ class ParserConfigValidTest {
.setBroadcastReceiverClassName("broadcast")
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build())
.addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_DYNAMIC)
.setId("dynamic_disabled")
@@ -116,6 +117,7 @@ class ParserConfigValidTest {
.setBroadcastReceiverClassName("broadcast")
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build())
.build())
.addSafetySourcesGroup(SafetySourcesGroup.Builder()
diff --git a/tests/cts/safetycenter/src/android/safetycenter/config/cts/SafetySourceTest.kt b/tests/cts/safetycenter/src/android/safetycenter/config/cts/SafetySourceTest.kt
index 9970dddf6..830de10f4 100644
--- a/tests/cts/safetycenter/src/android/safetycenter/config/cts/SafetySourceTest.kt
+++ b/tests/cts/safetycenter/src/android/safetycenter/config/cts/SafetySourceTest.kt
@@ -262,6 +262,22 @@ class SafetySourceTest {
}
@Test
+ fun isAutomaticNotificationFromIssueAllowed_returnsAutoNotificationFromIssueAllowedOrThrows() {
+ assertThat(DYNAMIC_BAREBONE.isAutomaticNotificationFromIssueAllowed).isEqualTo(false)
+ assertThat(DYNAMIC_ALL_OPTIONAL.isAutomaticNotificationFromIssueAllowed).isEqualTo(true)
+ assertThat(DYNAMIC_DISABLED.isAutomaticNotificationFromIssueAllowed).isEqualTo(false)
+ assertThat(DYNAMIC_HIDDEN.isAutomaticNotificationFromIssueAllowed).isEqualTo(false)
+ assertThrows(UnsupportedOperationException::class.java) {
+ STATIC_BAREBONE.isAutomaticNotificationFromIssueAllowed
+ }
+ assertThrows(UnsupportedOperationException::class.java) {
+ STATIC_ALL_OPTIONAL.isAutomaticNotificationFromIssueAllowed
+ }
+ assertThat(ISSUE_ONLY_BAREBONE.isAutomaticNotificationFromIssueAllowed).isEqualTo(false)
+ assertThat(ISSUE_ONLY_ALL_OPTIONAL.isAutomaticNotificationFromIssueAllowed).isEqualTo(true)
+ }
+
+ @Test
fun describeContents_returns0() {
assertThat(DYNAMIC_BAREBONE.describeContents()).isEqualTo(0)
assertThat(DYNAMIC_ALL_OPTIONAL.describeContents()).isEqualTo(0)
@@ -329,6 +345,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalCopy)
}
@@ -362,6 +379,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@@ -382,6 +400,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@@ -402,6 +421,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@@ -422,6 +442,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@@ -442,6 +463,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@@ -462,6 +484,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@@ -493,6 +516,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@@ -513,6 +537,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@@ -533,6 +558,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@@ -553,12 +579,13 @@ class SafetySourceTest {
.setBroadcastReceiverClassName("other")
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@Test
- fun hashCode_equals_toString_withDifferentLoggingAlloweds_areNotEqual() {
+ fun hashCode_equals_toString_withDifferentLoggingAllowed_areNotEqual() {
val dynamicAllOptionalAlt = SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_DYNAMIC)
.setId(DYNAMIC_ALL_OPTIONAL_ID)
.setPackageName(PACKAGE_NAME)
@@ -573,12 +600,13 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(true)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@Test
- fun hashCode_equals_toString_withDifferentRefreshOnPageOpenAlloweds_areNotEqual() {
+ fun hashCode_equals_toString_withDifferentRefreshOnPageOpenAllowed_areNotEqual() {
val dynamicAllOptionalAlt = SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_DYNAMIC)
.setId(DYNAMIC_ALL_OPTIONAL_ID)
.setPackageName(PACKAGE_NAME)
@@ -593,6 +621,28 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(false)
+ .setAutomaticNotificationFromIssueAllowed(true)
+ .build()
+ AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
+ }
+
+ @Test
+ fun hashCode_equals_toString_withDifferentAutomaticNotificationFromIssueAllowed_areNotEqual() {
+ val dynamicAllOptionalAlt = SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_DYNAMIC)
+ .setId(DYNAMIC_ALL_OPTIONAL_ID)
+ .setPackageName(PACKAGE_NAME)
+ .setTitleResId(REFERENCE_RES_ID)
+ .setTitleForWorkResId(REFERENCE_RES_ID)
+ .setSummaryResId(REFERENCE_RES_ID)
+ .setIntentAction(INTENT_ACTION)
+ .setProfile(SafetySource.PROFILE_ALL)
+ .setInitialDisplayState(SafetySource.INITIAL_DISPLAY_STATE_DISABLED)
+ .setMaxSeverityLevel(MAX_SEVERITY_LEVEL)
+ .setSearchTermsResId(REFERENCE_RES_ID)
+ .setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
+ .setLoggingAllowed(false)
+ .setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(false)
.build()
AnyTester.assertThatRepresentationsAreNotEqual(DYNAMIC_ALL_OPTIONAL, dynamicAllOptionalAlt)
}
@@ -638,6 +688,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
private val DYNAMIC_DISABLED =
@@ -694,6 +745,7 @@ class SafetySourceTest {
.setBroadcastReceiverClassName(BROADCAST_RECEIVER_CLASS_NAME)
.setLoggingAllowed(false)
.setRefreshOnPageOpenAllowed(true)
+ .setAutomaticNotificationFromIssueAllowed(true)
.build()
}
}