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