Jeff Brown | 4d69e22 | 2014-09-18 15:27:50 -0700 | [diff] [blame] | 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 { |
| 25 | void addCallback(@NonNull Callback callback); |
| 26 | void removeCallback(@NonNull Callback callback); |
Adrian Roos | ff2c456 | 2016-11-03 12:13:36 -0700 | [diff] [blame] | 27 | void startDozing(); |
John Spurlock | eab28e6 | 2014-11-29 11:33:49 -0500 | [diff] [blame] | 28 | void pulseWhileDozing(@NonNull PulseCallback callback, int reason); |
Jeff Brown | 4d69e22 | 2014-09-18 15:27:50 -0700 | [diff] [blame] | 29 | void stopDozing(); |
Adrian Roos | ebea7a7 | 2016-10-26 12:51:26 -0700 | [diff] [blame] | 30 | void dozeTimeTick(); |
Jeff Brown | 4d69e22 | 2014-09-18 15:27:50 -0700 | [diff] [blame] | 31 | boolean isPowerSaveActive(); |
Jorim Jaggi | 007f0e8 | 2015-08-14 13:56:01 -0700 | [diff] [blame] | 32 | boolean isPulsingBlocked(); |
Adrian Roos | f2d545e | 2017-07-05 16:45:42 +0200 | [diff] [blame] | 33 | boolean isProvisioned(); |
Adrian Roos | 710a0b1 | 2017-07-07 19:02:34 +0200 | [diff] [blame] | 34 | boolean isBlockingDoze(); |
Jeff Brown | 4d69e22 | 2014-09-18 15:27:50 -0700 | [diff] [blame] | 35 | |
Lucas Dupin | 5f00fa5 | 2019-03-27 22:46:53 -0700 | [diff] [blame] | 36 | /** |
| 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 Roos | f9d13f6 | 2016-11-08 15:42:20 -0800 | [diff] [blame] | 41 | |
Adrian Roos | 28f90c7 | 2017-05-08 17:24:26 -0700 | [diff] [blame] | 42 | void setAnimateWakeup(boolean animateWakeup); |
Lucas Dupin | 43d0d73 | 2017-11-16 11:23:49 -0800 | [diff] [blame] | 43 | void setAnimateScreenOff(boolean animateScreenOff); |
Adrian Roos | 28f90c7 | 2017-05-08 17:24:26 -0700 | [diff] [blame] | 44 | |
Lucas Dupin | d43bf70 | 2019-01-15 13:40:42 -0800 | [diff] [blame] | 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 | */ |
| 51 | void onSlpiTap(float x, float y); |
Adrian Roos | 25c7a58 | 2017-06-02 12:50:38 -0700 | [diff] [blame] | 52 | |
Lucas Dupin | 34306c3 | 2019-07-16 11:56:53 -0700 | [diff] [blame] | 53 | /** |
| 54 | * Artificially dim down the the display by changing scrim opacities. |
| 55 | * @param scrimOpacity opacity from 0 to 1. |
| 56 | */ |
Adrian Roos | c8e29e7 | 2017-08-03 18:25:42 +0200 | [diff] [blame] | 57 | default void setAodDimmingScrim(float scrimOpacity) {} |
Lucas Dupin | 34306c3 | 2019-07-16 11:56:53 -0700 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Sets the actual display brightness. |
| 61 | * @param value from 0 to 255. |
| 62 | */ |
Adrian Roos | 3e23eb5 | 2017-07-07 15:58:57 +0200 | [diff] [blame] | 63 | void setDozeScreenBrightness(int value); |
Adrian Roos | f2d545e | 2017-07-05 16:45:42 +0200 | [diff] [blame] | 64 | |
Lucas Dupin | 34306c3 | 2019-07-16 11:56:53 -0700 | [diff] [blame] | 65 | /** |
| 66 | * Makes scrims black and changes animation durations. |
| 67 | */ |
| 68 | default void prepareForGentleWakeUp() {} |
| 69 | |
Adrian Roos | a6c03f8 | 2017-07-26 16:20:30 +0200 | [diff] [blame] | 70 | void onIgnoreTouchWhilePulsing(boolean ignore); |
| 71 | |
TYM Tsai | 2fc027d | 2018-12-04 19:28:19 +0800 | [diff] [blame] | 72 | /** |
| 73 | * Leaves pulsing state, going back to ambient UI. |
| 74 | */ |
| 75 | void stopPulsing(); |
| 76 | |
Adrian Roos | f9d13f6 | 2016-11-08 15:42:20 -0800 | [diff] [blame] | 77 | interface Callback { |
Kevin | a97ea05 | 2018-09-11 13:53:18 -0700 | [diff] [blame] | 78 | /** |
| 79 | * Called when a high priority notification is added. |
Selim Cinek | 65c96f2 | 2019-07-25 20:09:04 -0700 | [diff] [blame] | 80 | * @param onPulseSuppressedListener A listener that is invoked if the pulse is being |
| 81 | * supressed. |
Kevin | a97ea05 | 2018-09-11 13:53:18 -0700 | [diff] [blame] | 82 | */ |
Selim Cinek | 65c96f2 | 2019-07-25 20:09:04 -0700 | [diff] [blame] | 83 | default void onNotificationAlerted(Runnable onPulseSuppressedListener) {} |
Kevin | a97ea05 | 2018-09-11 13:53:18 -0700 | [diff] [blame] | 84 | |
| 85 | /** |
| 86 | * Called when battery state or power save mode changes. |
| 87 | * @param active whether power save is active or not |
| 88 | */ |
Adrian Roos | f9d13f6 | 2016-11-08 15:42:20 -0800 | [diff] [blame] | 89 | default void onPowerSaveChanged(boolean active) {} |
Jeff Brown | 4d69e22 | 2014-09-18 15:27:50 -0700 | [diff] [blame] | 90 | } |
| 91 | |
Adrian Roos | f9d13f6 | 2016-11-08 15:42:20 -0800 | [diff] [blame] | 92 | interface PulseCallback { |
Jeff Brown | 4d69e22 | 2014-09-18 15:27:50 -0700 | [diff] [blame] | 93 | void onPulseStarted(); |
| 94 | void onPulseFinished(); |
| 95 | } |
Christoph Studer | 27ef018 | 2014-12-02 18:49:49 +0000 | [diff] [blame] | 96 | } |