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); 27 void startDozing(); 28 void pulseWhileDozing(@NonNull PulseCallback callback, int reason); 29 void stopDozing(); 30 void dozeTimeTick(); 31 boolean isPowerSaveActive(); 32 boolean isPulsingBlocked(); 33 boolean isProvisioned(); 34 boolean isBlockingDoze(); 35 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); 41 42 void setAnimateWakeup(boolean animateWakeup); 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 */ 51 void onSlpiTap(float x, float y); 52 53 default void setAodDimmingScrim(float scrimOpacity) {} 54 void setDozeScreenBrightness(int value); 55 56 void onIgnoreTouchWhilePulsing(boolean ignore); 57 58 /** 59 * Leaves pulsing state, going back to ambient UI. 60 */ 61 void stopPulsing(); 62 63 interface Callback { 64 /** 65 * Called when a high priority notification is added. 66 */ 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 */ 73 default void onPowerSaveChanged(boolean active) {} 74 } 75 76 interface PulseCallback { 77 void onPulseStarted(); 78 void onPulseFinished(); 79 } 80 } 81