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