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

Commit f3484fae authored by Matías Hernández's avatar Matías Hernández
Browse files

Add (hidden) setPackage() in AZR.Builder

Bug: 333528586
Test: atest ZenModeHelperTest
Flag: android.app.modes_api
Change-Id: I34194f99c25e9ba81ee4c3072f05c36acd26edf4
parent a90e5fb3
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -843,6 +843,15 @@ public final class AutomaticZenRule implements Parcelable {
            return this;
        }

        /**
         * Sets the package that owns this rule
         * @hide
         */
        public @NonNull Builder setPackage(@NonNull String pkg) {
            mPkg = pkg;
            return this;
        }

        public @NonNull AutomaticZenRule build() {
            AutomaticZenRule rule = new AutomaticZenRule(mName, mOwner, mConfigurationActivity,
                    mConditionId, mPolicy, mInterruptionFilter, mEnabled);
+2 −1
Original line number Diff line number Diff line
@@ -1446,6 +1446,7 @@ public class ZenModeHelper {
        if (Flags.modesApi()) {
            azr = new AutomaticZenRule.Builder(rule.name, rule.conditionId)
                    .setManualInvocationAllowed(rule.allowManualInvocation)
                    .setPackage(rule.pkg)
                    .setCreationTime(rule.creationTime)
                    .setIconResId(drawableResNameToResId(rule.pkg, rule.iconResName))
                    .setType(rule.type)
@@ -1464,8 +1465,8 @@ public class ZenModeHelper {
                    rule.conditionId, rule.zenPolicy,
                    NotificationManager.zenModeToInterruptionFilter(rule.zenMode),
                    rule.enabled, rule.creationTime);
        }
            azr.setPackageName(rule.pkg);
        }
        return azr;
    }