Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb8302bf authored by Matías Hernández's avatar Matías Hernández Committed by Android (Google) Code Review
Browse files

Merge "AutomaticZenRule.Builder - default type should be UNKNOWN" into main

parents a34be389 fff7d29d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -676,7 +676,7 @@ public final class AutomaticZenRule implements Parcelable {
        private ComponentName mConfigurationActivity = null;
        private ZenPolicy mPolicy = null;
        private ZenDeviceEffects mDeviceEffects = null;
        private int mType;
        private int mType = TYPE_UNKNOWN;
        private String mDescription;
        private int mIconResId;
        private boolean mAllowManualInvocation;
+20 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.app;

import static com.google.common.truth.Truth.assertThat;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.fail;

@@ -175,6 +177,24 @@ public class AutomaticZenRuleTest {
                () -> new AutomaticZenRule.Builder("name", null));
    }

    @Test
    @EnableFlags(Flags.FLAG_MODES_API)
    public void constructor_defaultTypeUnknown() {
        AutomaticZenRule rule = new AutomaticZenRule("name", new ComponentName("pkg", "cps"), null,
                Uri.parse("conditionId"), null, NotificationManager.INTERRUPTION_FILTER_PRIORITY,
                true);

        assertThat(rule.getType()).isEqualTo(AutomaticZenRule.TYPE_UNKNOWN);
    }

    @Test
    @EnableFlags(Flags.FLAG_MODES_API)
    public void builder_defaultTypeUnknown() {
        AutomaticZenRule rule = new AutomaticZenRule.Builder("name",
                Uri.parse("conditionId")).build();

        assertThat(rule.getType()).isEqualTo(AutomaticZenRule.TYPE_UNKNOWN);
    }
    @Test
    @EnableFlags(Flags.FLAG_MODES_API)
    public void validate_builderWithValidType_succeeds() throws Exception {