Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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.statusbar.phone; |
| 18 | |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 19 | import android.annotation.ColorInt; |
| 20 | import android.annotation.DrawableRes; |
| 21 | import android.annotation.LayoutRes; |
John Spurlock | 257f283 | 2013-09-21 18:41:53 -0400 | [diff] [blame] | 22 | import android.app.StatusBarManager; |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 23 | import android.content.Context; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 24 | import android.content.res.Configuration; |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 25 | import android.content.res.TypedArray; |
Daniel Sandler | 198a030 | 2012-08-17 16:04:31 -0400 | [diff] [blame] | 26 | import android.graphics.Canvas; |
| 27 | import android.graphics.Paint; |
Selim Cinek | a0fad3b | 2014-09-19 17:20:05 +0200 | [diff] [blame] | 28 | import android.graphics.PorterDuff; |
| 29 | import android.graphics.PorterDuffXfermode; |
John Spurlock | fba9120 | 2014-04-22 12:58:26 -0400 | [diff] [blame] | 30 | import android.graphics.Rect; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 31 | import android.graphics.drawable.Drawable; |
Jaewan Kim | 5026936 | 2016-12-23 11:22:02 +0900 | [diff] [blame] | 32 | import android.media.AudioManager; |
John Spurlock | 0b99ea9 | 2014-10-01 15:32:22 -0400 | [diff] [blame] | 33 | import android.media.session.MediaSessionLegacyHelper; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 34 | import android.net.Uri; |
| 35 | import android.os.Bundle; |
Selim Cinek | a0fad3b | 2014-09-19 17:20:05 +0200 | [diff] [blame] | 36 | import android.os.IBinder; |
Adrian Roos | 8008bd1 | 2017-02-22 15:02:09 +0100 | [diff] [blame] | 37 | import android.os.SystemClock; |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 38 | import android.util.AttributeSet; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 39 | import android.view.ActionMode; |
felkachang | 7749c9a | 2018-06-11 15:56:15 +0800 | [diff] [blame] | 40 | import android.view.DisplayCutout; |
Selim Cinek | 48a92a5 | 2017-05-02 20:02:30 -0700 | [diff] [blame] | 41 | import android.view.InputDevice; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 42 | import android.view.InputQueue; |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 43 | import android.view.KeyEvent; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 44 | import android.view.LayoutInflater; |
| 45 | import android.view.Menu; |
| 46 | import android.view.MenuItem; |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 47 | import android.view.MotionEvent; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 48 | import android.view.SurfaceHolder; |
Daniel Sandler | b4e56ed | 2012-09-12 23:07:44 -0700 | [diff] [blame] | 49 | import android.view.View; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 50 | import android.view.ViewGroup; |
| 51 | import android.view.ViewTreeObserver; |
| 52 | import android.view.Window; |
Selim Cinek | a0fad3b | 2014-09-19 17:20:05 +0200 | [diff] [blame] | 53 | import android.view.WindowManager; |
| 54 | import android.view.WindowManagerGlobal; |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 55 | import android.widget.FrameLayout; |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 56 | |
Selim Cinek | f8c4add | 2017-06-08 09:54:58 -0700 | [diff] [blame] | 57 | import com.android.internal.annotations.VisibleForTesting; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 58 | import com.android.internal.view.FloatingActionMode; |
| 59 | import com.android.internal.widget.FloatingToolbar; |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 60 | import com.android.systemui.R; |
Blazej Magnowski | 0e2ffbd | 2015-09-10 14:37:17 -0700 | [diff] [blame] | 61 | import com.android.systemui.classifier.FalsingManager; |
Jorim Jaggi | ecbab36 | 2014-04-23 16:13:15 +0200 | [diff] [blame] | 62 | import com.android.systemui.statusbar.DragDownHelper; |
| 63 | import com.android.systemui.statusbar.StatusBarState; |
Selim Cinek | fab078b | 2014-03-27 22:45:58 +0100 | [diff] [blame] | 64 | import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 65 | |
Selim Cinek | fc5c199 | 2018-01-29 12:40:32 -0800 | [diff] [blame] | 66 | import java.io.FileDescriptor; |
| 67 | import java.io.PrintWriter; |
| 68 | |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 69 | |
Jorim Jaggi | ecbab36 | 2014-04-23 16:13:15 +0200 | [diff] [blame] | 70 | public class StatusBarWindowView extends FrameLayout { |
Daniel Sandler | 198a030 | 2012-08-17 16:04:31 -0400 | [diff] [blame] | 71 | public static final String TAG = "StatusBarWindowView"; |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 72 | public static final boolean DEBUG = StatusBar.DEBUG; |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 73 | |
Jorim Jaggi | ecbab36 | 2014-04-23 16:13:15 +0200 | [diff] [blame] | 74 | private DragDownHelper mDragDownHelper; |
Adrian Roos | 8008bd1 | 2017-02-22 15:02:09 +0100 | [diff] [blame] | 75 | private DoubleTapHelper mDoubleTapHelper; |
Selim Cinek | b6d85eb | 2014-03-28 20:21:01 +0100 | [diff] [blame] | 76 | private NotificationStackScrollLayout mStackScrollLayout; |
Daniel Sandler | b4e56ed | 2012-09-12 23:07:44 -0700 | [diff] [blame] | 77 | private NotificationPanelView mNotificationPanel; |
Adrian Roos | 9dc3209 | 2014-09-02 23:34:10 +0200 | [diff] [blame] | 78 | private View mBrightnessMirror; |
Jorim Jaggi | 45611dd | 2018-06-19 17:27:08 +0200 | [diff] [blame] | 79 | private PhoneStatusBarView mStatusBarView; |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 80 | |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 81 | private int mRightInset = 0; |
Adrian Roos | 85d202b | 2016-06-02 16:27:47 -0700 | [diff] [blame] | 82 | private int mLeftInset = 0; |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 83 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 84 | private StatusBar mService; |
Selim Cinek | a0fad3b | 2014-09-19 17:20:05 +0200 | [diff] [blame] | 85 | private final Paint mTransparentSrcPaint = new Paint(); |
Blazej Magnowski | 0e2ffbd | 2015-09-10 14:37:17 -0700 | [diff] [blame] | 86 | private FalsingManager mFalsingManager; |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 87 | |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 88 | // Implements the floating action mode for TextView's Cut/Copy/Past menu. Normally provided by |
| 89 | // DecorView, but since this is a special window we have to roll our own. |
| 90 | private View mFloatingActionModeOriginatingView; |
| 91 | private ActionMode mFloatingActionMode; |
| 92 | private FloatingToolbar mFloatingToolbar; |
| 93 | private ViewTreeObserver.OnPreDrawListener mFloatingToolbarPreDrawListener; |
Selim Cinek | 48a92a5 | 2017-05-02 20:02:30 -0700 | [diff] [blame] | 94 | private boolean mTouchCancelled; |
| 95 | private boolean mTouchActive; |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 96 | private boolean mExpandAnimationRunning; |
Selim Cinek | 7e222c3c | 2018-01-25 12:22:41 -0800 | [diff] [blame] | 97 | private boolean mExpandAnimationPending; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 98 | |
Jorim Jaggi | 0d4a995 | 2018-06-06 17:22:56 +0200 | [diff] [blame] | 99 | /** |
| 100 | * If set to true, the current gesture started below the notch and we need to dispatch touch |
| 101 | * events manually as it's outside of the regular view bounds. |
| 102 | */ |
| 103 | private boolean mExpandingBelowNotch; |
| 104 | |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 105 | public StatusBarWindowView(Context context, AttributeSet attrs) { |
| 106 | super(context, attrs); |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 107 | setMotionEventSplittingEnabled(false); |
Selim Cinek | a0fad3b | 2014-09-19 17:20:05 +0200 | [diff] [blame] | 108 | mTransparentSrcPaint.setColor(0); |
| 109 | mTransparentSrcPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC)); |
Blazej Magnowski | 0e2ffbd | 2015-09-10 14:37:17 -0700 | [diff] [blame] | 110 | mFalsingManager = FalsingManager.getInstance(context); |
Adrian Roos | 8008bd1 | 2017-02-22 15:02:09 +0100 | [diff] [blame] | 111 | mDoubleTapHelper = new DoubleTapHelper(this, active -> {}, () -> { |
| 112 | mService.wakeUpIfDozing(SystemClock.uptimeMillis(), this); |
| 113 | return true; |
| 114 | }, null, null); |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | @Override |
John Spurlock | fba9120 | 2014-04-22 12:58:26 -0400 | [diff] [blame] | 118 | protected boolean fitSystemWindows(Rect insets) { |
| 119 | if (getFitsSystemWindows()) { |
Adrian Roos | 85d202b | 2016-06-02 16:27:47 -0700 | [diff] [blame] | 120 | boolean paddingChanged = insets.top != getPaddingTop() |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 121 | || insets.bottom != getPaddingBottom(); |
Jorim Jaggi | aa80614 | 2015-05-20 18:04:16 -0700 | [diff] [blame] | 122 | |
felkachang | 7749c9a | 2018-06-11 15:56:15 +0800 | [diff] [blame] | 123 | int rightCutout = 0; |
| 124 | int leftCutout = 0; |
| 125 | DisplayCutout displayCutout = getRootWindowInsets().getDisplayCutout(); |
| 126 | if (displayCutout != null) { |
| 127 | leftCutout = displayCutout.getSafeInsetLeft(); |
| 128 | rightCutout = displayCutout.getSafeInsetRight(); |
| 129 | } |
| 130 | |
| 131 | int targetLeft = Math.max(insets.left, leftCutout); |
| 132 | int targetRight = Math.max(insets.right, rightCutout); |
| 133 | |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 134 | // Super-special right inset handling, because scrims and backdrop need to ignore it. |
felkachang | 7749c9a | 2018-06-11 15:56:15 +0800 | [diff] [blame] | 135 | if (targetRight != mRightInset || targetLeft != mLeftInset) { |
| 136 | mRightInset = targetRight; |
| 137 | mLeftInset = targetLeft; |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 138 | applyMargins(); |
| 139 | } |
Adrian Roos | 85d202b | 2016-06-02 16:27:47 -0700 | [diff] [blame] | 140 | // Drop top inset, and pass through bottom inset. |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 141 | if (paddingChanged) { |
Adrian Roos | 85d202b | 2016-06-02 16:27:47 -0700 | [diff] [blame] | 142 | setPadding(0, 0, 0, 0); |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 143 | } |
Jorim Jaggi | d7daab7 | 2014-05-06 22:22:20 +0200 | [diff] [blame] | 144 | insets.left = 0; |
| 145 | insets.top = 0; |
| 146 | insets.right = 0; |
John Spurlock | fba9120 | 2014-04-22 12:58:26 -0400 | [diff] [blame] | 147 | } else { |
Adrian Roos | 85d202b | 2016-06-02 16:27:47 -0700 | [diff] [blame] | 148 | if (mRightInset != 0 || mLeftInset != 0) { |
Adrian Roos | e49e409 | 2015-06-10 18:50:18 -0700 | [diff] [blame] | 149 | mRightInset = 0; |
Adrian Roos | 85d202b | 2016-06-02 16:27:47 -0700 | [diff] [blame] | 150 | mLeftInset = 0; |
Adrian Roos | e49e409 | 2015-06-10 18:50:18 -0700 | [diff] [blame] | 151 | applyMargins(); |
| 152 | } |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 153 | boolean changed = getPaddingLeft() != 0 |
| 154 | || getPaddingRight() != 0 |
| 155 | || getPaddingTop() != 0 |
| 156 | || getPaddingBottom() != 0; |
| 157 | if (changed) { |
| 158 | setPadding(0, 0, 0, 0); |
| 159 | } |
Jorim Jaggi | aa80614 | 2015-05-20 18:04:16 -0700 | [diff] [blame] | 160 | insets.top = 0; |
John Spurlock | fba9120 | 2014-04-22 12:58:26 -0400 | [diff] [blame] | 161 | } |
Jorim Jaggi | d7daab7 | 2014-05-06 22:22:20 +0200 | [diff] [blame] | 162 | return false; |
John Spurlock | fba9120 | 2014-04-22 12:58:26 -0400 | [diff] [blame] | 163 | } |
| 164 | |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 165 | private void applyMargins() { |
| 166 | final int N = getChildCount(); |
| 167 | for (int i = 0; i < N; i++) { |
| 168 | View child = getChildAt(i); |
| 169 | if (child.getLayoutParams() instanceof LayoutParams) { |
| 170 | LayoutParams lp = (LayoutParams) child.getLayoutParams(); |
Adrian Roos | 85d202b | 2016-06-02 16:27:47 -0700 | [diff] [blame] | 171 | if (!lp.ignoreRightInset |
| 172 | && (lp.rightMargin != mRightInset || lp.leftMargin != mLeftInset)) { |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 173 | lp.rightMargin = mRightInset; |
Adrian Roos | 85d202b | 2016-06-02 16:27:47 -0700 | [diff] [blame] | 174 | lp.leftMargin = mLeftInset; |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 175 | child.requestLayout(); |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | @Override |
| 182 | public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attrs) { |
| 183 | return new LayoutParams(getContext(), attrs); |
| 184 | } |
| 185 | |
| 186 | @Override |
| 187 | protected FrameLayout.LayoutParams generateDefaultLayoutParams() { |
| 188 | return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); |
| 189 | } |
| 190 | |
John Spurlock | fba9120 | 2014-04-22 12:58:26 -0400 | [diff] [blame] | 191 | @Override |
Selim Cinek | 4e6b2d3 | 2015-06-25 20:15:33 -0400 | [diff] [blame] | 192 | protected void onFinishInflate() { |
| 193 | super.onFinishInflate(); |
Selim Cinek | b6d85eb | 2014-03-28 20:21:01 +0100 | [diff] [blame] | 194 | mStackScrollLayout = (NotificationStackScrollLayout) findViewById( |
| 195 | R.id.notification_stack_scroller); |
Daniel Sandler | b4e56ed | 2012-09-12 23:07:44 -0700 | [diff] [blame] | 196 | mNotificationPanel = (NotificationPanelView) findViewById(R.id.notification_panel); |
Adrian Roos | 9dc3209 | 2014-09-02 23:34:10 +0200 | [diff] [blame] | 197 | mBrightnessMirror = findViewById(R.id.brightness_mirror); |
Selim Cinek | 4e6b2d3 | 2015-06-25 20:15:33 -0400 | [diff] [blame] | 198 | } |
| 199 | |
dooyoung.hwang | e4b841e | 2016-11-16 08:59:23 +0900 | [diff] [blame] | 200 | @Override |
| 201 | public void onViewAdded(View child) { |
| 202 | super.onViewAdded(child); |
| 203 | if (child.getId() == R.id.brightness_mirror) { |
| 204 | mBrightnessMirror = child; |
| 205 | } |
| 206 | } |
| 207 | |
Jorim Jaggi | 45611dd | 2018-06-19 17:27:08 +0200 | [diff] [blame] | 208 | public void setStatusBarView(PhoneStatusBarView statusBarView) { |
| 209 | mStatusBarView = statusBarView; |
| 210 | } |
| 211 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 212 | public void setService(StatusBar service) { |
Selim Cinek | 4e6b2d3 | 2015-06-25 20:15:33 -0400 | [diff] [blame] | 213 | mService = service; |
Selim Cinek | f8c4add | 2017-06-08 09:54:58 -0700 | [diff] [blame] | 214 | setDragDownHelper(new DragDownHelper(getContext(), this, mStackScrollLayout, mService)); |
| 215 | } |
| 216 | |
| 217 | @VisibleForTesting |
| 218 | void setDragDownHelper(DragDownHelper dragDownHelper) { |
| 219 | mDragDownHelper = dragDownHelper; |
Selim Cinek | 4e6b2d3 | 2015-06-25 20:15:33 -0400 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | @Override |
| 223 | protected void onAttachedToWindow () { |
| 224 | super.onAttachedToWindow(); |
Daniel Sandler | b10d885 | 2013-05-08 15:57:06 -0400 | [diff] [blame] | 225 | |
Selim Cinek | a0fad3b | 2014-09-19 17:20:05 +0200 | [diff] [blame] | 226 | // We need to ensure that our window doesn't suffer from overdraw which would normally |
| 227 | // occur if our window is translucent. Since we are drawing the whole window anyway with |
| 228 | // the scrim, we don't need the window to be cleared in the beginning. |
Jorim Jaggi | 0e66439 | 2014-09-27 01:30:22 +0200 | [diff] [blame] | 229 | if (mService.isScrimSrcModeEnabled()) { |
| 230 | IBinder windowToken = getWindowToken(); |
| 231 | WindowManager.LayoutParams lp = (WindowManager.LayoutParams) getLayoutParams(); |
| 232 | lp.token = windowToken; |
| 233 | setLayoutParams(lp); |
| 234 | WindowManagerGlobal.getInstance().changeCanvasOpacity(windowToken, true); |
| 235 | setWillNotDraw(false); |
| 236 | } else { |
| 237 | setWillNotDraw(!DEBUG); |
| 238 | } |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | @Override |
| 242 | public boolean dispatchKeyEvent(KeyEvent event) { |
Adrian Roos | 56cf73a | 2016-07-18 14:23:32 -0700 | [diff] [blame] | 243 | if (mService.interceptMediaKey(event)) { |
| 244 | return true; |
| 245 | } |
| 246 | if (super.dispatchKeyEvent(event)) { |
| 247 | return true; |
| 248 | } |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 249 | boolean down = event.getAction() == KeyEvent.ACTION_DOWN; |
| 250 | switch (event.getKeyCode()) { |
Jorim Jaggi | 8c8bcc1 | 2014-04-16 21:36:51 +0200 | [diff] [blame] | 251 | case KeyEvent.KEYCODE_BACK: |
| 252 | if (!down) { |
| 253 | mService.onBackPressed(); |
| 254 | } |
| 255 | return true; |
| 256 | case KeyEvent.KEYCODE_MENU: |
| 257 | if (!down) { |
| 258 | return mService.onMenuPressed(); |
| 259 | } |
Jorim Jaggi | 3425076 | 2014-07-03 23:51:19 +0200 | [diff] [blame] | 260 | case KeyEvent.KEYCODE_SPACE: |
| 261 | if (!down) { |
| 262 | return mService.onSpacePressed(); |
| 263 | } |
John Spurlock | 0b99ea9 | 2014-10-01 15:32:22 -0400 | [diff] [blame] | 264 | break; |
John Spurlock | d06aa57 | 2014-09-10 10:40:49 -0400 | [diff] [blame] | 265 | case KeyEvent.KEYCODE_VOLUME_DOWN: |
| 266 | case KeyEvent.KEYCODE_VOLUME_UP: |
John Spurlock | 0b99ea9 | 2014-10-01 15:32:22 -0400 | [diff] [blame] | 267 | if (mService.isDozing()) { |
Jaewan Kim | 5026936 | 2016-12-23 11:22:02 +0900 | [diff] [blame] | 268 | MediaSessionLegacyHelper.getHelper(mContext).sendVolumeKeyEvent( |
| 269 | event, AudioManager.USE_DEFAULT_STREAM_TYPE, true); |
John Spurlock | 0b99ea9 | 2014-10-01 15:32:22 -0400 | [diff] [blame] | 270 | return true; |
John Spurlock | d06aa57 | 2014-09-10 10:40:49 -0400 | [diff] [blame] | 271 | } |
John Spurlock | 0b99ea9 | 2014-10-01 15:32:22 -0400 | [diff] [blame] | 272 | break; |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 273 | } |
Adrian Roos | 56cf73a | 2016-07-18 14:23:32 -0700 | [diff] [blame] | 274 | return false; |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 275 | } |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 276 | |
Selim Cinek | d95ca7c | 2017-07-26 12:20:38 -0700 | [diff] [blame] | 277 | public void setTouchActive(boolean touchActive) { |
| 278 | mTouchActive = touchActive; |
Selim Cinek | d95ca7c | 2017-07-26 12:20:38 -0700 | [diff] [blame] | 279 | } |
| 280 | |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 281 | @Override |
Adrian Roos | 9dc3209 | 2014-09-02 23:34:10 +0200 | [diff] [blame] | 282 | public boolean dispatchTouchEvent(MotionEvent ev) { |
Selim Cinek | 48a92a5 | 2017-05-02 20:02:30 -0700 | [diff] [blame] | 283 | boolean isDown = ev.getActionMasked() == MotionEvent.ACTION_DOWN; |
Jorim Jaggi | 0d4a995 | 2018-06-06 17:22:56 +0200 | [diff] [blame] | 284 | boolean isUp = ev.getActionMasked() == MotionEvent.ACTION_UP; |
Adrian Roos | a6c03f8 | 2017-07-26 16:20:30 +0200 | [diff] [blame] | 285 | boolean isCancel = ev.getActionMasked() == MotionEvent.ACTION_CANCEL; |
Jorim Jaggi | 0d4a995 | 2018-06-06 17:22:56 +0200 | [diff] [blame] | 286 | |
| 287 | // Reset manual touch dispatch state here but make sure the UP/CANCEL event still gets |
| 288 | // delivered. |
| 289 | boolean expandingBelowNotch = mExpandingBelowNotch; |
| 290 | if (isUp || isCancel) { |
| 291 | mExpandingBelowNotch = false; |
| 292 | } |
| 293 | |
Adrian Roos | a6c03f8 | 2017-07-26 16:20:30 +0200 | [diff] [blame] | 294 | if (!isCancel && mService.shouldIgnoreTouch()) { |
| 295 | return false; |
| 296 | } |
Selim Cinek | 48a92a5 | 2017-05-02 20:02:30 -0700 | [diff] [blame] | 297 | if (isDown && mNotificationPanel.isFullyCollapsed()) { |
Jorim Jaggi | e05256e | 2016-09-08 14:58:20 -0700 | [diff] [blame] | 298 | mNotificationPanel.startExpandLatencyTracking(); |
| 299 | } |
Selim Cinek | 48a92a5 | 2017-05-02 20:02:30 -0700 | [diff] [blame] | 300 | if (isDown) { |
Selim Cinek | d95ca7c | 2017-07-26 12:20:38 -0700 | [diff] [blame] | 301 | setTouchActive(true); |
Selim Cinek | 48a92a5 | 2017-05-02 20:02:30 -0700 | [diff] [blame] | 302 | mTouchCancelled = false; |
| 303 | } else if (ev.getActionMasked() == MotionEvent.ACTION_UP |
| 304 | || ev.getActionMasked() == MotionEvent.ACTION_CANCEL) { |
Selim Cinek | d95ca7c | 2017-07-26 12:20:38 -0700 | [diff] [blame] | 305 | setTouchActive(false); |
Selim Cinek | 48a92a5 | 2017-05-02 20:02:30 -0700 | [diff] [blame] | 306 | } |
Selim Cinek | 7e222c3c | 2018-01-25 12:22:41 -0800 | [diff] [blame] | 307 | if (mTouchCancelled || mExpandAnimationRunning || mExpandAnimationPending) { |
Selim Cinek | 48a92a5 | 2017-05-02 20:02:30 -0700 | [diff] [blame] | 308 | return false; |
| 309 | } |
Blazej Magnowski | 0e2ffbd | 2015-09-10 14:37:17 -0700 | [diff] [blame] | 310 | mFalsingManager.onTouchEvent(ev, getWidth(), getHeight()); |
Adrian Roos | 9dc3209 | 2014-09-02 23:34:10 +0200 | [diff] [blame] | 311 | if (mBrightnessMirror != null && mBrightnessMirror.getVisibility() == VISIBLE) { |
| 312 | // Disallow new pointers while the brightness mirror is visible. This is so that you |
| 313 | // can't touch anything other than the brightness slider while the mirror is showing |
| 314 | // and the rest of the panel is transparent. |
| 315 | if (ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) { |
| 316 | return false; |
| 317 | } |
| 318 | } |
Selim Cinek | 48a92a5 | 2017-05-02 20:02:30 -0700 | [diff] [blame] | 319 | if (isDown) { |
Mady Mellor | 7a9b2a6 | 2016-03-23 07:41:47 -0700 | [diff] [blame] | 320 | mStackScrollLayout.closeControlsIfOutsideTouch(ev); |
| 321 | } |
Adrian Roos | 67cca74 | 2017-04-13 16:52:51 -0700 | [diff] [blame] | 322 | if (mService.isDozing()) { |
| 323 | mService.mDozeScrimController.extendPulse(); |
| 324 | } |
Mady Mellor | 7a9b2a6 | 2016-03-23 07:41:47 -0700 | [diff] [blame] | 325 | |
Jorim Jaggi | 0d4a995 | 2018-06-06 17:22:56 +0200 | [diff] [blame] | 326 | // In case we start outside of the view bounds (below the status bar), we need to dispatch |
| 327 | // the touch manually as the view system can't accomodate for touches outside of the |
| 328 | // regular view bounds. |
| 329 | if (isDown && ev.getY() >= mBottom) { |
| 330 | mExpandingBelowNotch = true; |
| 331 | expandingBelowNotch = true; |
| 332 | } |
| 333 | if (expandingBelowNotch) { |
Jorim Jaggi | 45611dd | 2018-06-19 17:27:08 +0200 | [diff] [blame] | 334 | return mStatusBarView.dispatchTouchEvent(ev); |
Jorim Jaggi | 0d4a995 | 2018-06-06 17:22:56 +0200 | [diff] [blame] | 335 | } |
| 336 | |
Adrian Roos | 9dc3209 | 2014-09-02 23:34:10 +0200 | [diff] [blame] | 337 | return super.dispatchTouchEvent(ev); |
| 338 | } |
| 339 | |
| 340 | @Override |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 341 | public boolean onInterceptTouchEvent(MotionEvent ev) { |
Selim Cinek | be2c443 | 2017-05-30 12:11:09 -0700 | [diff] [blame] | 342 | if (mService.isDozing() && !mStackScrollLayout.hasPulsingNotifications()) { |
Adrian Roos | 8008bd1 | 2017-02-22 15:02:09 +0100 | [diff] [blame] | 343 | // Capture all touch events in always-on. |
Adrian Roos | ebea7a7 | 2016-10-26 12:51:26 -0700 | [diff] [blame] | 344 | return true; |
| 345 | } |
Daniel Sandler | b4e56ed | 2012-09-12 23:07:44 -0700 | [diff] [blame] | 346 | boolean intercept = false; |
Selim Cinek | fab078b | 2014-03-27 22:45:58 +0100 | [diff] [blame] | 347 | if (mNotificationPanel.isFullyExpanded() |
Jorim Jaggi | 03c701e | 2014-04-02 12:39:51 +0200 | [diff] [blame] | 348 | && mStackScrollLayout.getVisibility() == View.VISIBLE |
Jorim Jaggi | 4222d9a | 2014-04-23 16:13:15 +0200 | [diff] [blame] | 349 | && mService.getBarState() == StatusBarState.KEYGUARD |
Adrian Roos | 500263a | 2017-01-23 14:49:54 -0800 | [diff] [blame] | 350 | && !mService.isBouncerShowing() |
| 351 | && !mService.isDozing()) { |
Jorim Jaggi | ecbab36 | 2014-04-23 16:13:15 +0200 | [diff] [blame] | 352 | intercept = mDragDownHelper.onInterceptTouchEvent(ev); |
Daniel Sandler | b4e56ed | 2012-09-12 23:07:44 -0700 | [diff] [blame] | 353 | } |
| 354 | if (!intercept) { |
| 355 | super.onInterceptTouchEvent(ev); |
| 356 | } |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 357 | if (intercept) { |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 358 | MotionEvent cancellation = MotionEvent.obtain(ev); |
| 359 | cancellation.setAction(MotionEvent.ACTION_CANCEL); |
Selim Cinek | b6d85eb | 2014-03-28 20:21:01 +0100 | [diff] [blame] | 360 | mStackScrollLayout.onInterceptTouchEvent(cancellation); |
Selim Cinek | 31094df | 2014-08-14 19:28:15 +0200 | [diff] [blame] | 361 | mNotificationPanel.onInterceptTouchEvent(cancellation); |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 362 | cancellation.recycle(); |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 363 | } |
| 364 | return intercept; |
| 365 | } |
| 366 | |
| 367 | @Override |
| 368 | public boolean onTouchEvent(MotionEvent ev) { |
Adrian Roos | 8008bd1 | 2017-02-22 15:02:09 +0100 | [diff] [blame] | 369 | boolean handled = false; |
| 370 | if (mService.isDozing()) { |
| 371 | mDoubleTapHelper.onTouchEvent(ev); |
| 372 | handled = true; |
| 373 | } |
Selim Cinek | f8c4add | 2017-06-08 09:54:58 -0700 | [diff] [blame] | 374 | if ((mService.getBarState() == StatusBarState.KEYGUARD && !handled) |
| 375 | || mDragDownHelper.isDraggingDown()) { |
Selim Cinek | 740c111 | 2016-12-22 16:39:54 +0100 | [diff] [blame] | 376 | // we still want to finish our drag down gesture when locking the screen |
Jorim Jaggi | ecbab36 | 2014-04-23 16:13:15 +0200 | [diff] [blame] | 377 | handled = mDragDownHelper.onTouchEvent(ev); |
Daniel Sandler | b4e56ed | 2012-09-12 23:07:44 -0700 | [diff] [blame] | 378 | } |
| 379 | if (!handled) { |
| 380 | handled = super.onTouchEvent(ev); |
| 381 | } |
John Spurlock | 257f283 | 2013-09-21 18:41:53 -0400 | [diff] [blame] | 382 | final int action = ev.getAction(); |
John Spurlock | d157ca0 | 2013-11-04 10:28:05 -0500 | [diff] [blame] | 383 | if (!handled && (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL)) { |
John Spurlock | 257f283 | 2013-09-21 18:41:53 -0400 | [diff] [blame] | 384 | mService.setInteracting(StatusBarManager.WINDOW_STATUS_BAR, false); |
| 385 | } |
Chris Wren | 5de6e94 | 2012-05-16 14:22:21 -0400 | [diff] [blame] | 386 | return handled; |
| 387 | } |
Daniel Sandler | 198a030 | 2012-08-17 16:04:31 -0400 | [diff] [blame] | 388 | |
| 389 | @Override |
| 390 | public void onDraw(Canvas canvas) { |
| 391 | super.onDraw(canvas); |
Jorim Jaggi | 0e66439 | 2014-09-27 01:30:22 +0200 | [diff] [blame] | 392 | if (mService.isScrimSrcModeEnabled()) { |
| 393 | // We need to ensure that our window is always drawn fully even when we have paddings, |
| 394 | // since we simulate it to be opaque. |
| 395 | int paddedBottom = getHeight() - getPaddingBottom(); |
| 396 | int paddedRight = getWidth() - getPaddingRight(); |
| 397 | if (getPaddingTop() != 0) { |
| 398 | canvas.drawRect(0, 0, getWidth(), getPaddingTop(), mTransparentSrcPaint); |
| 399 | } |
| 400 | if (getPaddingBottom() != 0) { |
| 401 | canvas.drawRect(0, paddedBottom, getWidth(), getHeight(), mTransparentSrcPaint); |
| 402 | } |
| 403 | if (getPaddingLeft() != 0) { |
| 404 | canvas.drawRect(0, getPaddingTop(), getPaddingLeft(), paddedBottom, |
| 405 | mTransparentSrcPaint); |
| 406 | } |
| 407 | if (getPaddingRight() != 0) { |
| 408 | canvas.drawRect(paddedRight, getPaddingTop(), getWidth(), paddedBottom, |
| 409 | mTransparentSrcPaint); |
| 410 | } |
Selim Cinek | a0fad3b | 2014-09-19 17:20:05 +0200 | [diff] [blame] | 411 | } |
Daniel Sandler | 198a030 | 2012-08-17 16:04:31 -0400 | [diff] [blame] | 412 | if (DEBUG) { |
| 413 | Paint pt = new Paint(); |
| 414 | pt.setColor(0x80FFFF00); |
| 415 | pt.setStrokeWidth(12.0f); |
| 416 | pt.setStyle(Paint.Style.STROKE); |
| 417 | canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), pt); |
| 418 | } |
| 419 | } |
Daniel Sandler | ac47ff7 | 2012-10-23 10:41:44 -0400 | [diff] [blame] | 420 | |
| 421 | public void cancelExpandHelper() { |
Selim Cinek | 1408eb5 | 2014-06-02 14:45:38 +0200 | [diff] [blame] | 422 | if (mStackScrollLayout != null) { |
| 423 | mStackScrollLayout.cancelExpandHelper(); |
Daniel Sandler | 1a3bdd5 | 2012-10-23 19:21:20 -0400 | [diff] [blame] | 424 | } |
Daniel Sandler | ac47ff7 | 2012-10-23 10:41:44 -0400 | [diff] [blame] | 425 | } |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 426 | |
Selim Cinek | 48a92a5 | 2017-05-02 20:02:30 -0700 | [diff] [blame] | 427 | public void cancelCurrentTouch() { |
| 428 | if (mTouchActive) { |
| 429 | final long now = SystemClock.uptimeMillis(); |
| 430 | MotionEvent event = MotionEvent.obtain(now, now, |
| 431 | MotionEvent.ACTION_CANCEL, 0.0f, 0.0f, 0); |
| 432 | event.setSource(InputDevice.SOURCE_TOUCHSCREEN); |
| 433 | dispatchTouchEvent(event); |
| 434 | event.recycle(); |
| 435 | mTouchCancelled = true; |
| 436 | } |
| 437 | } |
| 438 | |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 439 | public void setExpandAnimationRunning(boolean expandAnimationRunning) { |
| 440 | mExpandAnimationRunning = expandAnimationRunning; |
| 441 | } |
| 442 | |
Selim Cinek | 7e222c3c | 2018-01-25 12:22:41 -0800 | [diff] [blame] | 443 | public void setExpandAnimationPending(boolean pending) { |
| 444 | mExpandAnimationPending = pending; |
| 445 | } |
| 446 | |
Selim Cinek | fc5c199 | 2018-01-29 12:40:32 -0800 | [diff] [blame] | 447 | public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { |
| 448 | pw.print(" mExpandAnimationPending="); pw.println(mExpandAnimationPending); |
| 449 | pw.print(" mExpandAnimationRunning="); pw.println(mExpandAnimationRunning); |
| 450 | pw.print(" mTouchCancelled="); pw.println(mTouchCancelled); |
| 451 | pw.print(" mTouchActive="); pw.println(mTouchActive); |
| 452 | } |
| 453 | |
Adrian Roos | 2f2bd9a | 2015-06-04 18:11:14 -0700 | [diff] [blame] | 454 | public class LayoutParams extends FrameLayout.LayoutParams { |
| 455 | |
| 456 | public boolean ignoreRightInset; |
| 457 | |
| 458 | public LayoutParams(int width, int height) { |
| 459 | super(width, height); |
| 460 | } |
| 461 | |
| 462 | public LayoutParams(Context c, AttributeSet attrs) { |
| 463 | super(c, attrs); |
| 464 | |
| 465 | TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.StatusBarWindowView_Layout); |
| 466 | ignoreRightInset = a.getBoolean( |
| 467 | R.styleable.StatusBarWindowView_Layout_ignoreRightInset, false); |
| 468 | a.recycle(); |
| 469 | } |
| 470 | } |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 471 | |
| 472 | @Override |
| 473 | public ActionMode startActionModeForChild(View originalView, ActionMode.Callback callback, |
| 474 | int type) { |
| 475 | if (type == ActionMode.TYPE_FLOATING) { |
| 476 | return startActionMode(originalView, callback, type); |
| 477 | } |
| 478 | return super.startActionModeForChild(originalView, callback, type); |
| 479 | } |
| 480 | |
| 481 | private ActionMode createFloatingActionMode( |
| 482 | View originatingView, ActionMode.Callback2 callback) { |
| 483 | if (mFloatingActionMode != null) { |
| 484 | mFloatingActionMode.finish(); |
| 485 | } |
| 486 | cleanupFloatingActionModeViews(); |
Tarandeep Singh | c9c83a9 | 2017-08-29 14:39:22 -0700 | [diff] [blame] | 487 | mFloatingToolbar = new FloatingToolbar(mFakeWindow); |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 488 | final FloatingActionMode mode = |
Abodunrinwa Toki | 17293cc | 2017-05-22 14:16:04 +0100 | [diff] [blame] | 489 | new FloatingActionMode(mContext, callback, originatingView, mFloatingToolbar); |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 490 | mFloatingActionModeOriginatingView = originatingView; |
| 491 | mFloatingToolbarPreDrawListener = |
| 492 | new ViewTreeObserver.OnPreDrawListener() { |
| 493 | @Override |
| 494 | public boolean onPreDraw() { |
| 495 | mode.updateViewLocationInWindow(); |
| 496 | return true; |
| 497 | } |
| 498 | }; |
| 499 | return mode; |
| 500 | } |
| 501 | |
| 502 | private void setHandledFloatingActionMode(ActionMode mode) { |
| 503 | mFloatingActionMode = mode; |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 504 | mFloatingActionMode.invalidate(); // Will show the floating toolbar if necessary. |
| 505 | mFloatingActionModeOriginatingView.getViewTreeObserver() |
| 506 | .addOnPreDrawListener(mFloatingToolbarPreDrawListener); |
| 507 | } |
| 508 | |
| 509 | private void cleanupFloatingActionModeViews() { |
| 510 | if (mFloatingToolbar != null) { |
| 511 | mFloatingToolbar.dismiss(); |
| 512 | mFloatingToolbar = null; |
| 513 | } |
| 514 | if (mFloatingActionModeOriginatingView != null) { |
| 515 | if (mFloatingToolbarPreDrawListener != null) { |
| 516 | mFloatingActionModeOriginatingView.getViewTreeObserver() |
| 517 | .removeOnPreDrawListener(mFloatingToolbarPreDrawListener); |
| 518 | mFloatingToolbarPreDrawListener = null; |
| 519 | } |
| 520 | mFloatingActionModeOriginatingView = null; |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | private ActionMode startActionMode( |
| 525 | View originatingView, ActionMode.Callback callback, int type) { |
| 526 | ActionMode.Callback2 wrappedCallback = new ActionModeCallback2Wrapper(callback); |
| 527 | ActionMode mode = createFloatingActionMode(originatingView, wrappedCallback); |
| 528 | if (mode != null && wrappedCallback.onCreateActionMode(mode, mode.getMenu())) { |
| 529 | setHandledFloatingActionMode(mode); |
| 530 | } else { |
| 531 | mode = null; |
| 532 | } |
| 533 | return mode; |
| 534 | } |
| 535 | |
| 536 | private class ActionModeCallback2Wrapper extends ActionMode.Callback2 { |
| 537 | private final ActionMode.Callback mWrapped; |
| 538 | |
| 539 | public ActionModeCallback2Wrapper(ActionMode.Callback wrapped) { |
| 540 | mWrapped = wrapped; |
| 541 | } |
| 542 | |
| 543 | public boolean onCreateActionMode(ActionMode mode, Menu menu) { |
| 544 | return mWrapped.onCreateActionMode(mode, menu); |
| 545 | } |
| 546 | |
| 547 | public boolean onPrepareActionMode(ActionMode mode, Menu menu) { |
| 548 | requestFitSystemWindows(); |
| 549 | return mWrapped.onPrepareActionMode(mode, menu); |
| 550 | } |
| 551 | |
| 552 | public boolean onActionItemClicked(ActionMode mode, MenuItem item) { |
| 553 | return mWrapped.onActionItemClicked(mode, item); |
| 554 | } |
| 555 | |
| 556 | public void onDestroyActionMode(ActionMode mode) { |
| 557 | mWrapped.onDestroyActionMode(mode); |
| 558 | if (mode == mFloatingActionMode) { |
| 559 | cleanupFloatingActionModeViews(); |
| 560 | mFloatingActionMode = null; |
| 561 | } |
| 562 | requestFitSystemWindows(); |
| 563 | } |
| 564 | |
| 565 | @Override |
| 566 | public void onGetContentRect(ActionMode mode, View view, Rect outRect) { |
| 567 | if (mWrapped instanceof ActionMode.Callback2) { |
| 568 | ((ActionMode.Callback2) mWrapped).onGetContentRect(mode, view, outRect); |
| 569 | } else { |
| 570 | super.onGetContentRect(mode, view, outRect); |
| 571 | } |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | /** |
| 576 | * Minimal window to satisfy FloatingToolbar. |
| 577 | */ |
| 578 | private Window mFakeWindow = new Window(mContext) { |
| 579 | @Override |
| 580 | public void takeSurface(SurfaceHolder.Callback2 callback) { |
| 581 | } |
| 582 | |
| 583 | @Override |
| 584 | public void takeInputQueue(InputQueue.Callback callback) { |
| 585 | } |
| 586 | |
| 587 | @Override |
| 588 | public boolean isFloating() { |
| 589 | return false; |
| 590 | } |
| 591 | |
| 592 | @Override |
| 593 | public void alwaysReadCloseOnTouchAttr() { |
| 594 | } |
| 595 | |
| 596 | @Override |
| 597 | public void setContentView(@LayoutRes int layoutResID) { |
| 598 | } |
| 599 | |
| 600 | @Override |
| 601 | public void setContentView(View view) { |
| 602 | } |
| 603 | |
| 604 | @Override |
| 605 | public void setContentView(View view, ViewGroup.LayoutParams params) { |
| 606 | } |
| 607 | |
| 608 | @Override |
| 609 | public void addContentView(View view, ViewGroup.LayoutParams params) { |
| 610 | } |
| 611 | |
| 612 | @Override |
| 613 | public void clearContentView() { |
| 614 | } |
| 615 | |
| 616 | @Override |
| 617 | public View getCurrentFocus() { |
| 618 | return null; |
| 619 | } |
| 620 | |
| 621 | @Override |
| 622 | public LayoutInflater getLayoutInflater() { |
| 623 | return null; |
| 624 | } |
| 625 | |
| 626 | @Override |
| 627 | public void setTitle(CharSequence title) { |
| 628 | } |
| 629 | |
| 630 | @Override |
| 631 | public void setTitleColor(@ColorInt int textColor) { |
| 632 | } |
| 633 | |
| 634 | @Override |
| 635 | public void openPanel(int featureId, KeyEvent event) { |
| 636 | } |
| 637 | |
| 638 | @Override |
| 639 | public void closePanel(int featureId) { |
| 640 | } |
| 641 | |
| 642 | @Override |
| 643 | public void togglePanel(int featureId, KeyEvent event) { |
| 644 | } |
| 645 | |
| 646 | @Override |
| 647 | public void invalidatePanelMenu(int featureId) { |
| 648 | } |
| 649 | |
| 650 | @Override |
| 651 | public boolean performPanelShortcut(int featureId, int keyCode, KeyEvent event, int flags) { |
| 652 | return false; |
| 653 | } |
| 654 | |
| 655 | @Override |
| 656 | public boolean performPanelIdentifierAction(int featureId, int id, int flags) { |
| 657 | return false; |
| 658 | } |
| 659 | |
| 660 | @Override |
| 661 | public void closeAllPanels() { |
| 662 | } |
| 663 | |
| 664 | @Override |
| 665 | public boolean performContextMenuIdentifierAction(int id, int flags) { |
| 666 | return false; |
| 667 | } |
| 668 | |
| 669 | @Override |
| 670 | public void onConfigurationChanged(Configuration newConfig) { |
| 671 | } |
| 672 | |
| 673 | @Override |
| 674 | public void setBackgroundDrawable(Drawable drawable) { |
| 675 | } |
| 676 | |
| 677 | @Override |
| 678 | public void setFeatureDrawableResource(int featureId, @DrawableRes int resId) { |
| 679 | } |
| 680 | |
| 681 | @Override |
| 682 | public void setFeatureDrawableUri(int featureId, Uri uri) { |
| 683 | } |
| 684 | |
| 685 | @Override |
| 686 | public void setFeatureDrawable(int featureId, Drawable drawable) { |
| 687 | } |
| 688 | |
| 689 | @Override |
| 690 | public void setFeatureDrawableAlpha(int featureId, int alpha) { |
| 691 | } |
| 692 | |
| 693 | @Override |
| 694 | public void setFeatureInt(int featureId, int value) { |
| 695 | } |
| 696 | |
| 697 | @Override |
| 698 | public void takeKeyEvents(boolean get) { |
| 699 | } |
| 700 | |
| 701 | @Override |
| 702 | public boolean superDispatchKeyEvent(KeyEvent event) { |
| 703 | return false; |
| 704 | } |
| 705 | |
| 706 | @Override |
| 707 | public boolean superDispatchKeyShortcutEvent(KeyEvent event) { |
| 708 | return false; |
| 709 | } |
| 710 | |
| 711 | @Override |
| 712 | public boolean superDispatchTouchEvent(MotionEvent event) { |
| 713 | return false; |
| 714 | } |
| 715 | |
| 716 | @Override |
| 717 | public boolean superDispatchTrackballEvent(MotionEvent event) { |
| 718 | return false; |
| 719 | } |
| 720 | |
| 721 | @Override |
| 722 | public boolean superDispatchGenericMotionEvent(MotionEvent event) { |
| 723 | return false; |
| 724 | } |
| 725 | |
| 726 | @Override |
| 727 | public View getDecorView() { |
| 728 | return StatusBarWindowView.this; |
| 729 | } |
| 730 | |
| 731 | @Override |
| 732 | public View peekDecorView() { |
| 733 | return null; |
| 734 | } |
| 735 | |
| 736 | @Override |
| 737 | public Bundle saveHierarchyState() { |
| 738 | return null; |
| 739 | } |
| 740 | |
| 741 | @Override |
| 742 | public void restoreHierarchyState(Bundle savedInstanceState) { |
| 743 | } |
| 744 | |
| 745 | @Override |
| 746 | protected void onActive() { |
| 747 | } |
| 748 | |
| 749 | @Override |
| 750 | public void setChildDrawable(int featureId, Drawable drawable) { |
| 751 | } |
| 752 | |
| 753 | @Override |
| 754 | public void setChildInt(int featureId, int value) { |
| 755 | } |
| 756 | |
| 757 | @Override |
| 758 | public boolean isShortcutKey(int keyCode, KeyEvent event) { |
| 759 | return false; |
| 760 | } |
| 761 | |
| 762 | @Override |
| 763 | public void setVolumeControlStream(int streamType) { |
| 764 | } |
| 765 | |
| 766 | @Override |
| 767 | public int getVolumeControlStream() { |
| 768 | return 0; |
| 769 | } |
| 770 | |
| 771 | @Override |
| 772 | public int getStatusBarColor() { |
| 773 | return 0; |
| 774 | } |
| 775 | |
| 776 | @Override |
| 777 | public void setStatusBarColor(@ColorInt int color) { |
| 778 | } |
| 779 | |
| 780 | @Override |
| 781 | public int getNavigationBarColor() { |
| 782 | return 0; |
| 783 | } |
| 784 | |
| 785 | @Override |
| 786 | public void setNavigationBarColor(@ColorInt int color) { |
| 787 | } |
| 788 | |
| 789 | @Override |
| 790 | public void setDecorCaptionShade(int decorCaptionShade) { |
| 791 | } |
| 792 | |
| 793 | @Override |
| 794 | public void setResizingCaptionDrawable(Drawable drawable) { |
| 795 | } |
| 796 | |
| 797 | @Override |
Andrii Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 798 | public void onMultiWindowModeChanged() { |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 799 | } |
| 800 | |
| 801 | @Override |
Winson Chung | 4d8681f | 2017-05-23 16:22:08 -0700 | [diff] [blame] | 802 | public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) { |
| 803 | } |
| 804 | |
| 805 | @Override |
Adrian Roos | 0bd8a4b | 2016-03-14 16:21:44 -0700 | [diff] [blame] | 806 | public void reportActivityRelaunched() { |
| 807 | } |
| 808 | }; |
| 809 | |
Daniel Sandler | c4f2a56 | 2012-05-04 11:55:46 -0400 | [diff] [blame] | 810 | } |
| 811 | |