blob: 07dd2cd7704367e933c2bb239a9d2e3ee8939846 [file] [log] [blame]
Jeff Brown4d69e222014-09-18 15:27:50 -07001/*
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
17package com.android.systemui.doze;
18
19import android.annotation.NonNull;
20
21/**
22 * Interface the doze service uses to communicate with the rest of system UI.
23 */
24public interface DozeHost {
25 void addCallback(@NonNull Callback callback);
26 void removeCallback(@NonNull Callback callback);
Adrian Roosff2c4562016-11-03 12:13:36 -070027 void startDozing();
John Spurlockeab28e62014-11-29 11:33:49 -050028 void pulseWhileDozing(@NonNull PulseCallback callback, int reason);
Jeff Brown4d69e222014-09-18 15:27:50 -070029 void stopDozing();
Adrian Roosebea7a72016-10-26 12:51:26 -070030 void dozeTimeTick();
Jeff Brown4d69e222014-09-18 15:27:50 -070031 boolean isPowerSaveActive();
Jorim Jaggi007f0e82015-08-14 13:56:01 -070032 boolean isPulsingBlocked();
Adrian Roosf2d545e2017-07-05 16:45:42 +020033 boolean isProvisioned();
Adrian Roos710a0b12017-07-07 19:02:34 +020034 boolean isBlockingDoze();
Jeff Brown4d69e222014-09-18 15:27:50 -070035
Lucas Dupin5f00fa52019-03-27 22:46:53 -070036 /**
37 * Makes a current pulse last for twice as long.
38 * @param reason why we're extending it.
39 */
40 void extendPulse(int reason);
Adrian Roosf9d13f62016-11-08 15:42:20 -080041
Adrian Roos28f90c72017-05-08 17:24:26 -070042 void setAnimateWakeup(boolean animateWakeup);
Lucas Dupin43d0d732017-11-16 11:23:49 -080043 void setAnimateScreenOff(boolean animateScreenOff);
Adrian Roos28f90c72017-05-08 17:24:26 -070044
Lucas Dupind43bf702019-01-15 13:40:42 -080045 /**
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 */
51 void onSlpiTap(float x, float y);
Adrian Roos25c7a582017-06-02 12:50:38 -070052
Lucas Dupin34306c32019-07-16 11:56:53 -070053 /**
54 * Artificially dim down the the display by changing scrim opacities.
55 * @param scrimOpacity opacity from 0 to 1.
56 */
Adrian Roosc8e29e72017-08-03 18:25:42 +020057 default void setAodDimmingScrim(float scrimOpacity) {}
Lucas Dupin34306c32019-07-16 11:56:53 -070058
59 /**
60 * Sets the actual display brightness.
61 * @param value from 0 to 255.
62 */
Adrian Roos3e23eb52017-07-07 15:58:57 +020063 void setDozeScreenBrightness(int value);
Adrian Roosf2d545e2017-07-05 16:45:42 +020064
Lucas Dupin34306c32019-07-16 11:56:53 -070065 /**
66 * Makes scrims black and changes animation durations.
67 */
68 default void prepareForGentleWakeUp() {}
69
Adrian Roosa6c03f82017-07-26 16:20:30 +020070 void onIgnoreTouchWhilePulsing(boolean ignore);
71
TYM Tsai2fc027d2018-12-04 19:28:19 +080072 /**
73 * Leaves pulsing state, going back to ambient UI.
74 */
75 void stopPulsing();
76
Adrian Roosf9d13f62016-11-08 15:42:20 -080077 interface Callback {
Kevina97ea052018-09-11 13:53:18 -070078 /**
79 * Called when a high priority notification is added.
Selim Cinek65c96f22019-07-25 20:09:04 -070080 * @param onPulseSuppressedListener A listener that is invoked if the pulse is being
81 * supressed.
Kevina97ea052018-09-11 13:53:18 -070082 */
Selim Cinek65c96f22019-07-25 20:09:04 -070083 default void onNotificationAlerted(Runnable onPulseSuppressedListener) {}
Kevina97ea052018-09-11 13:53:18 -070084
85 /**
86 * Called when battery state or power save mode changes.
87 * @param active whether power save is active or not
88 */
Adrian Roosf9d13f62016-11-08 15:42:20 -080089 default void onPowerSaveChanged(boolean active) {}
Jeff Brown4d69e222014-09-18 15:27:50 -070090 }
91
Adrian Roosf9d13f62016-11-08 15:42:20 -080092 interface PulseCallback {
Jeff Brown4d69e222014-09-18 15:27:50 -070093 void onPulseStarted();
94 void onPulseFinished();
95 }
Christoph Studer27ef0182014-12-02 18:49:49 +000096}