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

Commit d14f5edb authored by Yuri Lin's avatar Yuri Lin
Browse files

Rename ZenPolicy.getPriorityChannels to getPriorityChannelsAllowed

Fixes: 315045597
Test: ZenModeHelperTest ZenAdaptersTest ZenModeConfigTest ZenPolicyTest
Change-Id: Ia14c48fac30bcde0a06ffd05b70d1b5c400435ba
parent ca6b6a21
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40574,7 +40574,7 @@ package android.service.notification {
    method public int getPriorityCategoryReminders();
    method public int getPriorityCategoryRepeatCallers();
    method public int getPriorityCategorySystem();
    method @FlaggedApi("android.app.modes_api") public int getPriorityChannels();
    method @FlaggedApi("android.app.modes_api") public int getPriorityChannelsAllowed();
    method public int getPriorityConversationSenders();
    method public int getPriorityMessageSenders();
    method public int getVisualEffectAmbient();
+2 −2
Original line number Diff line number Diff line
@@ -1053,7 +1053,7 @@ public class ZenModeConfig implements Parcelable {
                out);

        if (Flags.modesApi()) {
            writeZenPolicyState(ALLOW_ATT_CHANNELS, policy.getPriorityChannels(), out);
            writeZenPolicyState(ALLOW_ATT_CHANNELS, policy.getPriorityChannelsAllowed(), out);
        }
    }

@@ -1381,7 +1381,7 @@ public class ZenModeConfig implements Parcelable {
        int state = defaultPolicy.state;
        if (Flags.modesApi()) {
            state = Policy.policyState(defaultPolicy.hasPriorityChannels(),
                    ZenPolicy.stateToBoolean(zenPolicy.getPriorityChannels(),
                    ZenPolicy.stateToBoolean(zenPolicy.getPriorityChannelsAllowed(),
                            DEFAULT_ALLOW_PRIORITY_CHANNELS));
        }

+2 −2
Original line number Diff line number Diff line
@@ -570,7 +570,7 @@ public final class ZenPolicy implements Parcelable {
     * with {@link NotificationChannel#canBypassDnd()} will be intercepted.
     */
    @FlaggedApi(Flags.FLAG_MODES_API)
    public @State int getPriorityChannels() {
    public @State int getPriorityChannelsAllowed() {
        switch (mAllowChannels) {
            case CHANNEL_POLICY_PRIORITY:
                return STATE_ALLOW;
@@ -1529,7 +1529,7 @@ public final class ZenPolicy implements Parcelable {
        proto.write(DNDPolicyProto.ALLOW_CONVERSATIONS_FROM, getPriorityConversationSenders());

        if (Flags.modesApi()) {
            proto.write(DNDPolicyProto.ALLOW_CHANNELS, getPriorityChannels());
            proto.write(DNDPolicyProto.ALLOW_CHANNELS, getPriorityChannelsAllowed());
        }

        proto.flush();
+1 −1
Original line number Diff line number Diff line
@@ -1183,7 +1183,7 @@ public class ZenModeHelper {
                    != newPolicy.getPriorityConversationSenders()) {
                userModifiedFields |= ZenPolicy.FIELD_CONVERSATIONS;
            }
            if (oldPolicy.getPriorityChannels() != newPolicy.getPriorityChannels()) {
            if (oldPolicy.getPriorityChannelsAllowed() != newPolicy.getPriorityChannelsAllowed()) {
                userModifiedFields |= ZenPolicy.FIELD_ALLOW_CHANNELS;
            }
            if (oldPolicy.getPriorityCategoryReminders()
+6 −4
Original line number Diff line number Diff line
@@ -143,12 +143,13 @@ public class ZenAdaptersTest extends UiServiceTestCase {
                Policy.policyState(false, true), 0);

        ZenPolicy zenPolicy = notificationPolicyToZenPolicy(policy);
        assertThat(zenPolicy.getPriorityChannels()).isEqualTo(ZenPolicy.STATE_ALLOW);
        assertThat(zenPolicy.getPriorityChannelsAllowed()).isEqualTo(ZenPolicy.STATE_ALLOW);

        Policy notAllowed = new Policy(0, 0, 0, 0,
                Policy.policyState(false, false), 0);
        ZenPolicy zenPolicyNotAllowed = notificationPolicyToZenPolicy(notAllowed);
        assertThat(zenPolicyNotAllowed.getPriorityChannels()).isEqualTo(ZenPolicy.STATE_DISALLOW);
        assertThat(zenPolicyNotAllowed.getPriorityChannelsAllowed()).isEqualTo(
                ZenPolicy.STATE_DISALLOW);
    }

    @Test
@@ -158,11 +159,12 @@ public class ZenAdaptersTest extends UiServiceTestCase {
                Policy.policyState(false, true), 0);

        ZenPolicy zenPolicy = notificationPolicyToZenPolicy(policy);
        assertThat(zenPolicy.getPriorityChannels()).isEqualTo(ZenPolicy.STATE_UNSET);
        assertThat(zenPolicy.getPriorityChannelsAllowed()).isEqualTo(ZenPolicy.STATE_UNSET);

        Policy notAllowed = new Policy(0, 0, 0, 0,
                Policy.policyState(false, false), 0);
        ZenPolicy zenPolicyNotAllowed = notificationPolicyToZenPolicy(notAllowed);
        assertThat(zenPolicyNotAllowed.getPriorityChannels()).isEqualTo(ZenPolicy.STATE_UNSET);
        assertThat(zenPolicyNotAllowed.getPriorityChannelsAllowed()).isEqualTo(
                ZenPolicy.STATE_UNSET);
    }
}
Loading