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