Adrian Roos | d35d4ca | 2017-04-19 14:31:03 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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; |
Adrian Roos | d35d4ca | 2017-04-19 14:31:03 -0700 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * A rudimentary fake for DozeHost. |
| 23 | */ |
| 24 | class DozeHostFake implements DozeHost { |
| 25 | Callback callback; |
Adrian Roos | 28f90c7 | 2017-05-08 17:24:26 -0700 | [diff] [blame] | 26 | boolean pulseExtended; |
| 27 | boolean animateWakeup; |
Lucas Dupin | 43d0d73 | 2017-11-16 11:23:49 -0800 | [diff] [blame] | 28 | boolean animateScreenOff; |
Adrian Roos | 540b528 | 2017-05-15 13:29:49 -0700 | [diff] [blame] | 29 | boolean dozing; |
Adrian Roos | 25c7a58 | 2017-06-02 12:50:38 -0700 | [diff] [blame] | 30 | float doubleTapX; |
| 31 | float doubleTapY; |
Adrian Roos | c7fd696 | 2017-09-06 16:46:46 +0200 | [diff] [blame] | 32 | float aodDimmingScrimOpacity; |
Adrian Roos | d35d4ca | 2017-04-19 14:31:03 -0700 | [diff] [blame] | 33 | |
| 34 | @Override |
| 35 | public void addCallback(@NonNull Callback callback) { |
| 36 | this.callback = callback; |
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | public void removeCallback(@NonNull Callback callback) { |
| 41 | this.callback = null; |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public void startDozing() { |
Adrian Roos | 540b528 | 2017-05-15 13:29:49 -0700 | [diff] [blame] | 46 | dozing = true; |
Adrian Roos | d35d4ca | 2017-04-19 14:31:03 -0700 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public void pulseWhileDozing(@NonNull PulseCallback callback, int reason) { |
| 51 | throw new RuntimeException("not implemented"); |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public void stopDozing() { |
Adrian Roos | 540b528 | 2017-05-15 13:29:49 -0700 | [diff] [blame] | 56 | dozing = false; |
Adrian Roos | d35d4ca | 2017-04-19 14:31:03 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public void dozeTimeTick() { |
Lucas Dupin | 4df92c3 | 2018-01-08 10:21:52 -0800 | [diff] [blame] | 61 | // Nothing to do in here. Real host would just update the UI. |
Adrian Roos | d35d4ca | 2017-04-19 14:31:03 -0700 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public boolean isPowerSaveActive() { |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public boolean isPulsingBlocked() { |
| 71 | return false; |
| 72 | } |
| 73 | |
| 74 | @Override |
Adrian Roos | f2d545e | 2017-07-05 16:45:42 +0200 | [diff] [blame] | 75 | public boolean isProvisioned() { |
| 76 | return false; |
| 77 | } |
| 78 | |
| 79 | @Override |
Adrian Roos | 710a0b1 | 2017-07-07 19:02:34 +0200 | [diff] [blame] | 80 | public boolean isBlockingDoze() { |
| 81 | return false; |
| 82 | } |
| 83 | |
| 84 | @Override |
Adrian Roos | a6c03f8 | 2017-07-26 16:20:30 +0200 | [diff] [blame] | 85 | public void onIgnoreTouchWhilePulsing(boolean ignore) { |
| 86 | } |
| 87 | |
| 88 | @Override |
Adrian Roos | d35d4ca | 2017-04-19 14:31:03 -0700 | [diff] [blame] | 89 | public void extendPulse() { |
| 90 | pulseExtended = true; |
| 91 | } |
Adrian Roos | 28f90c7 | 2017-05-08 17:24:26 -0700 | [diff] [blame] | 92 | |
| 93 | @Override |
TYM Tsai | 2fc027d | 2018-12-04 19:28:19 +0800 | [diff] [blame] | 94 | public void stopPulsing() {} |
| 95 | |
| 96 | @Override |
Adrian Roos | 28f90c7 | 2017-05-08 17:24:26 -0700 | [diff] [blame] | 97 | public void setAnimateWakeup(boolean animateWakeup) { |
| 98 | this.animateWakeup = animateWakeup; |
| 99 | } |
Adrian Roos | 25c7a58 | 2017-06-02 12:50:38 -0700 | [diff] [blame] | 100 | |
| 101 | @Override |
Lucas Dupin | 43d0d73 | 2017-11-16 11:23:49 -0800 | [diff] [blame] | 102 | public void setAnimateScreenOff(boolean animateScreenOff) { |
| 103 | this.animateScreenOff = animateScreenOff; |
| 104 | } |
| 105 | |
| 106 | @Override |
Lucas Dupin | d43bf70 | 2019-01-15 13:40:42 -0800 | [diff] [blame^] | 107 | public void onSlpiTap(float x, float y) { |
Adrian Roos | 25c7a58 | 2017-06-02 12:50:38 -0700 | [diff] [blame] | 108 | doubleTapX = y; |
| 109 | doubleTapY = y; |
| 110 | } |
Adrian Roos | 3e23eb5 | 2017-07-07 15:58:57 +0200 | [diff] [blame] | 111 | |
| 112 | @Override |
| 113 | public void setDozeScreenBrightness(int value) { |
| 114 | } |
Adrian Roos | c7fd696 | 2017-09-06 16:46:46 +0200 | [diff] [blame] | 115 | |
| 116 | @Override |
| 117 | public void setAodDimmingScrim(float scrimOpacity) { |
| 118 | aodDimmingScrimOpacity = scrimOpacity; |
| 119 | } |
Adrian Roos | d35d4ca | 2017-04-19 14:31:03 -0700 | [diff] [blame] | 120 | } |