1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.systemui.statusbar.policy; 18 19 import android.app.NotificationManager; 20 import android.content.ComponentName; 21 import android.net.Uri; 22 import android.service.notification.Condition; 23 import android.service.notification.ZenModeConfig; 24 import android.service.notification.ZenModeConfig.ZenRule; 25 26 import com.android.systemui.statusbar.policy.ZenModeController.Callback; 27 28 public interface ZenModeController extends CallbackController<Callback> { setZen(int zen, Uri conditionId, String reason)29 void setZen(int zen, Uri conditionId, String reason); getZen()30 int getZen(); getManualRule()31 ZenRule getManualRule(); getConfig()32 ZenModeConfig getConfig(); 33 /** Gets consolidated zen policy that will apply when DND is on in priority only mode */ getConsolidatedPolicy()34 NotificationManager.Policy getConsolidatedPolicy(); getNextAlarm()35 long getNextAlarm(); isZenAvailable()36 boolean isZenAvailable(); getEffectsSuppressor()37 ComponentName getEffectsSuppressor(); isCountdownConditionSupported()38 boolean isCountdownConditionSupported(); getCurrentUser()39 int getCurrentUser(); isVolumeRestricted()40 boolean isVolumeRestricted(); areNotificationsHiddenInShade()41 boolean areNotificationsHiddenInShade(); 42 43 public static interface Callback { onZenChanged(int zen)44 default void onZenChanged(int zen) {} onConditionsChanged(Condition[] conditions)45 default void onConditionsChanged(Condition[] conditions) {} onNextAlarmChanged()46 default void onNextAlarmChanged() {} onZenAvailableChanged(boolean available)47 default void onZenAvailableChanged(boolean available) {} onEffectsSupressorChanged()48 default void onEffectsSupressorChanged() {} onManualRuleChanged(ZenRule rule)49 default void onManualRuleChanged(ZenRule rule) {} onConfigChanged(ZenModeConfig config)50 default void onConfigChanged(ZenModeConfig config) {} 51 /** Called when the consolidated zen policy changes */ onConsolidatedPolicyChanged(NotificationManager.Policy policy)52 default void onConsolidatedPolicyChanged(NotificationManager.Policy policy) {} 53 } 54 55 }