• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.doze;
18 
19 import android.annotation.NonNull;
20 
21 /**
22  * Interface the doze service uses to communicate with the rest of system UI.
23  */
24 public interface DozeHost {
addCallback(@onNull Callback callback)25     void addCallback(@NonNull Callback callback);
removeCallback(@onNull Callback callback)26     void removeCallback(@NonNull Callback callback);
startDozing()27     void startDozing();
pulseWhileDozing(@onNull PulseCallback callback, int reason)28     void pulseWhileDozing(@NonNull PulseCallback callback, int reason);
stopDozing()29     void stopDozing();
dozeTimeTick()30     void dozeTimeTick();
isPowerSaveActive()31     boolean isPowerSaveActive();
isPulsingBlocked()32     boolean isPulsingBlocked();
isProvisioned()33     boolean isProvisioned();
isBlockingDoze()34     boolean isBlockingDoze();
35 
36     /**
37      * Makes a current pulse last for twice as long.
38      * @param reason why we're extending it.
39      */
extendPulse(int reason)40     void extendPulse(int reason);
41 
setAnimateWakeup(boolean animateWakeup)42     void setAnimateWakeup(boolean animateWakeup);
setAnimateScreenOff(boolean animateScreenOff)43     void setAnimateScreenOff(boolean animateScreenOff);
44 
45     /**
46      * Reports that a tap event happend on the Sensors Low Power Island.
47      *
48      * @param x Touch X, or -1 if sensor doesn't support touch location.
49      * @param y Touch Y, or -1 if sensor doesn't support touch location.
50      */
onSlpiTap(float x, float y)51     void onSlpiTap(float x, float y);
52 
setAodDimmingScrim(float scrimOpacity)53     default void setAodDimmingScrim(float scrimOpacity) {}
setDozeScreenBrightness(int value)54     void setDozeScreenBrightness(int value);
55 
onIgnoreTouchWhilePulsing(boolean ignore)56     void onIgnoreTouchWhilePulsing(boolean ignore);
57 
58     /**
59      * Leaves pulsing state, going back to ambient UI.
60      */
stopPulsing()61     void stopPulsing();
62 
63     interface Callback {
64         /**
65          * Called when a high priority notification is added.
66          */
onNotificationAlerted()67         default void onNotificationAlerted() {}
68 
69         /**
70          * Called when battery state or power save mode changes.
71          * @param active whether power save is active or not
72          */
onPowerSaveChanged(boolean active)73         default void onPowerSaveChanged(boolean active) {}
74     }
75 
76     interface PulseCallback {
onPulseStarted()77         void onPulseStarted();
onPulseFinished()78         void onPulseFinished();
79     }
80 }
81