Loading core/java/android/view/MotionEvent.java +8 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,14 @@ public final class MotionEvent extends InputEvent implements Parcelable { * Constant for {@link #getActionMasked}: A movement has happened outside of the * normal bounds of the UI element. This does not provide a full gesture, * but only the initial location of the movement/touch. * <p> * Note: Because the location of any event will be outside the * bounds of the view hierarchy, it will not get dispatched to * any children of a ViewGroup by default. Therefore, * movements with ACTION_OUTSIDE should be handled in either the * root {@link View} or in the appropriate {@link Window.Callback} * (e.g. {@link android.app.Activity} or {@link android.app.Dialog}). * </p> */ public static final int ACTION_OUTSIDE = 4; Loading packages/SystemUI/res/layout/navigation_bar_window.xml +2 −2 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ ** limitations under the License. */ --> <FrameLayout <com.android.systemui.statusbar.phone.NavigationBarFrame xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res-auto" android:id="@+id/navigation_bar_frame" android:layout_height="match_parent" android:layout_width="match_parent"> </FrameLayout> </com.android.systemui.statusbar.phone.NavigationBarFrame> packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFrame.java 0 → 100644 +59 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.android.systemui.statusbar.phone; import static android.view.MotionEvent.ACTION_OUTSIDE; import android.annotation.AttrRes; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.FrameLayout; import com.android.systemui.statusbar.policy.DeadZone; public class NavigationBarFrame extends FrameLayout { private DeadZone mDeadZone = null; public NavigationBarFrame(@NonNull Context context) { super(context); } public NavigationBarFrame(Context context, AttributeSet attrs) { super(context, attrs); } public NavigationBarFrame(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) { super(context, attrs, defStyleAttr); } public void setDeadZone(@NonNull DeadZone deadZone) { mDeadZone = deadZone; } @Override public boolean dispatchTouchEvent(MotionEvent event) { if (event.getAction() == ACTION_OUTSIDE) { if (mDeadZone != null) { return mDeadZone.onTouchEvent(event); } } return super.dispatchTouchEvent(event); } } No newline at end of file packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +1 −5 Original line number Diff line number Diff line Loading @@ -250,9 +250,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav if (mGestureHelper.onTouchEvent(event)) { return true; } if (mDeadZone != null && event.getAction() == MotionEvent.ACTION_OUTSIDE) { mDeadZone.poke(event); } return super.onTouchEvent(event); } Loading Loading @@ -614,9 +611,8 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav public void reorient() { updateCurrentView(); getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone); ((NavigationBarFrame) getRootView()).setDeadZone(mDeadZone); mDeadZone.setDisplayRotation(mCurrentRotation); // force the low profile & disabled states into compliance Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/DeadZone.java +2 −1 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ public class DeadZone extends View { final int action = event.getAction(); if (action == MotionEvent.ACTION_OUTSIDE) { poke(event); return true; } else if (action == MotionEvent.ACTION_DOWN) { if (DEBUG) { Slog.v(TAG, this + " ACTION_DOWN: " + event.getX() + "," + event.getY()); Loading Loading @@ -158,7 +159,7 @@ public class DeadZone extends View { return false; } public void poke(MotionEvent event) { private void poke(MotionEvent event) { mLastPokeTime = event.getEventTime(); if (DEBUG) Slog.v(TAG, "poked! size=" + getSize(mLastPokeTime)); Loading Loading
core/java/android/view/MotionEvent.java +8 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,14 @@ public final class MotionEvent extends InputEvent implements Parcelable { * Constant for {@link #getActionMasked}: A movement has happened outside of the * normal bounds of the UI element. This does not provide a full gesture, * but only the initial location of the movement/touch. * <p> * Note: Because the location of any event will be outside the * bounds of the view hierarchy, it will not get dispatched to * any children of a ViewGroup by default. Therefore, * movements with ACTION_OUTSIDE should be handled in either the * root {@link View} or in the appropriate {@link Window.Callback} * (e.g. {@link android.app.Activity} or {@link android.app.Dialog}). * </p> */ public static final int ACTION_OUTSIDE = 4; Loading
packages/SystemUI/res/layout/navigation_bar_window.xml +2 −2 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ ** limitations under the License. */ --> <FrameLayout <com.android.systemui.statusbar.phone.NavigationBarFrame xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res-auto" android:id="@+id/navigation_bar_frame" android:layout_height="match_parent" android:layout_width="match_parent"> </FrameLayout> </com.android.systemui.statusbar.phone.NavigationBarFrame>
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFrame.java 0 → 100644 +59 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.android.systemui.statusbar.phone; import static android.view.MotionEvent.ACTION_OUTSIDE; import android.annotation.AttrRes; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.FrameLayout; import com.android.systemui.statusbar.policy.DeadZone; public class NavigationBarFrame extends FrameLayout { private DeadZone mDeadZone = null; public NavigationBarFrame(@NonNull Context context) { super(context); } public NavigationBarFrame(Context context, AttributeSet attrs) { super(context, attrs); } public NavigationBarFrame(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) { super(context, attrs, defStyleAttr); } public void setDeadZone(@NonNull DeadZone deadZone) { mDeadZone = deadZone; } @Override public boolean dispatchTouchEvent(MotionEvent event) { if (event.getAction() == ACTION_OUTSIDE) { if (mDeadZone != null) { return mDeadZone.onTouchEvent(event); } } return super.dispatchTouchEvent(event); } } No newline at end of file
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +1 −5 Original line number Diff line number Diff line Loading @@ -250,9 +250,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav if (mGestureHelper.onTouchEvent(event)) { return true; } if (mDeadZone != null && event.getAction() == MotionEvent.ACTION_OUTSIDE) { mDeadZone.poke(event); } return super.onTouchEvent(event); } Loading Loading @@ -614,9 +611,8 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav public void reorient() { updateCurrentView(); getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone); ((NavigationBarFrame) getRootView()).setDeadZone(mDeadZone); mDeadZone.setDisplayRotation(mCurrentRotation); // force the low profile & disabled states into compliance Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/DeadZone.java +2 −1 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ public class DeadZone extends View { final int action = event.getAction(); if (action == MotionEvent.ACTION_OUTSIDE) { poke(event); return true; } else if (action == MotionEvent.ACTION_DOWN) { if (DEBUG) { Slog.v(TAG, this + " ACTION_DOWN: " + event.getX() + "," + event.getY()); Loading Loading @@ -158,7 +159,7 @@ public class DeadZone extends View { return false; } public void poke(MotionEvent event) { private void poke(MotionEvent event) { mLastPokeTime = event.getEventTime(); if (DEBUG) Slog.v(TAG, "poked! size=" + getSize(mLastPokeTime)); Loading