• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 android.service.notification;
18 
19 /**
20  * Responsible for making any service calls needed to apply the set of {@link ZenDeviceEffects} that
21  * make sense for the current platform.
22  * @hide
23  */
24 public interface DeviceEffectsApplier {
25     /**
26      * Applies the {@link ZenDeviceEffects} to the device.
27      *
28      * <p>The supplied {@code effects} represents the "consolidated" device effects, i.e. the
29      * union of the effects of all the {@link ZenModeConfig.ZenRule} instances that are currently
30      * active. If no rules are active (or no active rules specify custom effects) then {@code
31      * effects} will be all-default (i.e. {@link ZenDeviceEffects#hasEffects} will return {@code
32      * false}.
33      *
34      * <p>This will be called whenever the set of consolidated effects changes (normally through
35      * the activation or deactivation of zen rules).
36      *
37      * @param effects The effects that should be active and inactive.
38      * @param source The origin of the change. Because the application of specific effects can be
39      *               disruptive (e.g. lead to Activity recreation), that operation can in some
40      *               cases be deferred (e.g. until screen off). However, if the effects are
41      *               changing as a result of an explicit user action, then it makes sense to
42      *               apply them immediately regardless.
43      */
apply(ZenDeviceEffects effects, @ZenModeConfig.ConfigOrigin int source)44     void apply(ZenDeviceEffects effects, @ZenModeConfig.ConfigOrigin int source);
45 }
46