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