Merge "DO NOT MERGE Remove Pointer Capture API" into nyc-dev am: c396f0f70e
am: 4f6ae7bbaa
* commit '4f6ae7bbaa4654e14d70e9fa503ceb713c90c342':
DO NOT MERGE Remove Pointer Capture API
Change-Id: Ieceb1c9248bfc618ed1c70821d4cf746128bc679
This commit is contained in:
@@ -42554,7 +42554,6 @@ package android.view {
|
||||
method public boolean hasNestedScrollingParent();
|
||||
method public boolean hasOnClickListeners();
|
||||
method public boolean hasOverlappingRendering();
|
||||
method public boolean hasPointerCapture();
|
||||
method public boolean hasTransientState();
|
||||
method public boolean hasWindowFocus();
|
||||
method public static android.view.View inflate(android.content.Context, int, android.view.ViewGroup);
|
||||
@@ -42685,7 +42684,6 @@ package android.view {
|
||||
method public void postOnAnimation(java.lang.Runnable);
|
||||
method public void postOnAnimationDelayed(java.lang.Runnable, long);
|
||||
method public void refreshDrawableState();
|
||||
method public void releasePointerCapture();
|
||||
method public boolean removeCallbacks(java.lang.Runnable);
|
||||
method public void removeOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener);
|
||||
method public void removeOnLayoutChangeListener(android.view.View.OnLayoutChangeListener);
|
||||
@@ -42696,7 +42694,6 @@ package android.view {
|
||||
method public boolean requestFocus(int, android.graphics.Rect);
|
||||
method public final boolean requestFocusFromTouch();
|
||||
method public void requestLayout();
|
||||
method public void requestPointerCapture();
|
||||
method public boolean requestRectangleOnScreen(android.graphics.Rect);
|
||||
method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
|
||||
method public final void requestUnbufferedDispatch(android.view.MotionEvent);
|
||||
|
||||
@@ -45552,7 +45552,6 @@ package android.view {
|
||||
method public boolean hasNestedScrollingParent();
|
||||
method public boolean hasOnClickListeners();
|
||||
method public boolean hasOverlappingRendering();
|
||||
method public boolean hasPointerCapture();
|
||||
method public boolean hasTransientState();
|
||||
method public boolean hasWindowFocus();
|
||||
method public static android.view.View inflate(android.content.Context, int, android.view.ViewGroup);
|
||||
@@ -45683,7 +45682,6 @@ package android.view {
|
||||
method public void postOnAnimation(java.lang.Runnable);
|
||||
method public void postOnAnimationDelayed(java.lang.Runnable, long);
|
||||
method public void refreshDrawableState();
|
||||
method public void releasePointerCapture();
|
||||
method public boolean removeCallbacks(java.lang.Runnable);
|
||||
method public void removeOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener);
|
||||
method public void removeOnLayoutChangeListener(android.view.View.OnLayoutChangeListener);
|
||||
@@ -45694,7 +45692,6 @@ package android.view {
|
||||
method public boolean requestFocus(int, android.graphics.Rect);
|
||||
method public final boolean requestFocusFromTouch();
|
||||
method public void requestLayout();
|
||||
method public void requestPointerCapture();
|
||||
method public boolean requestRectangleOnScreen(android.graphics.Rect);
|
||||
method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
|
||||
method public final void requestUnbufferedDispatch(android.view.MotionEvent);
|
||||
|
||||
@@ -42634,7 +42634,6 @@ package android.view {
|
||||
method public boolean hasNestedScrollingParent();
|
||||
method public boolean hasOnClickListeners();
|
||||
method public boolean hasOverlappingRendering();
|
||||
method public boolean hasPointerCapture();
|
||||
method public boolean hasTransientState();
|
||||
method public boolean hasWindowFocus();
|
||||
method public static android.view.View inflate(android.content.Context, int, android.view.ViewGroup);
|
||||
@@ -42765,7 +42764,6 @@ package android.view {
|
||||
method public void postOnAnimation(java.lang.Runnable);
|
||||
method public void postOnAnimationDelayed(java.lang.Runnable, long);
|
||||
method public void refreshDrawableState();
|
||||
method public void releasePointerCapture();
|
||||
method public boolean removeCallbacks(java.lang.Runnable);
|
||||
method public void removeOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener);
|
||||
method public void removeOnLayoutChangeListener(android.view.View.OnLayoutChangeListener);
|
||||
@@ -42776,7 +42774,6 @@ package android.view {
|
||||
method public boolean requestFocus(int, android.graphics.Rect);
|
||||
method public final boolean requestFocusFromTouch();
|
||||
method public void requestLayout();
|
||||
method public void requestPointerCapture();
|
||||
method public boolean requestRectangleOnScreen(android.graphics.Rect);
|
||||
method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
|
||||
method public final void requestUnbufferedDispatch(android.view.MotionEvent);
|
||||
|
||||
@@ -81,6 +81,4 @@ interface IInputManager {
|
||||
|
||||
void setPointerIconType(int typeId);
|
||||
void setCustomPointerIcon(in PointerIcon icon);
|
||||
|
||||
void setPointerIconDetached(boolean detached);
|
||||
}
|
||||
|
||||
@@ -893,24 +893,6 @@ public final class InputManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the pointer icon status. When detached, the pointer icon disappears, and further
|
||||
* mouse location will be stuck at the current point. Mouse movement events will still arrive,
|
||||
* and movement should be handled through {@link MotionEvent.AXIS_RELATIVE_X} and
|
||||
* {@link MotionEvent.AXIS_RELATIVE_Y}.
|
||||
*
|
||||
* @param detached true if the icon will be detached from the actual mouse movement.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void setPointerIconDetached(boolean detached) {
|
||||
try {
|
||||
mIm.setPointerIconDetached(detached);
|
||||
} catch (RemoteException ex) {
|
||||
throw ex.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
private void populateInputDevicesLocked() {
|
||||
if (mInputDevicesChangedListener == null) {
|
||||
final InputDevicesChangedListener listener = new InputDevicesChangedListener();
|
||||
|
||||
@@ -15262,7 +15262,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
destroyDrawingCache();
|
||||
|
||||
cleanupDraw();
|
||||
releasePointerCapture();
|
||||
mCurrentAnimation = null;
|
||||
}
|
||||
|
||||
@@ -21836,57 +21835,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
return mPointerIcon;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Request capturing further mouse events.
|
||||
*
|
||||
* When the view captures, the pointer icon will disappear and will not change its
|
||||
* position. Further pointer events will come to the capturing view, and the pointer movements
|
||||
* will can be detected through {@link MotionEvent#AXIS_RELATIVE_X} and
|
||||
* {@link MotionEvent#AXIS_RELATIVE_Y}. Non-mouse events (touchscreens, or stylus) will not
|
||||
* be affected.
|
||||
*
|
||||
* The capture will be released through {@link #releasePointerCapture()}, or will be lost
|
||||
* automatically when the view or containing window disappear.
|
||||
*
|
||||
* @return true when succeeds.
|
||||
* @see #releasePointerCapture()
|
||||
* @see #hasPointerCapture()
|
||||
*/
|
||||
public void requestPointerCapture() {
|
||||
final ViewRootImpl viewRootImpl = getViewRootImpl();
|
||||
if (viewRootImpl != null) {
|
||||
viewRootImpl.requestPointerCapture(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Release the current capture of mouse events.
|
||||
*
|
||||
* If the view does not have the capture, it will do nothing.
|
||||
* @see #requestPointerCapture()
|
||||
* @see #hasPointerCapture()
|
||||
*/
|
||||
public void releasePointerCapture() {
|
||||
final ViewRootImpl viewRootImpl = getViewRootImpl();
|
||||
if (viewRootImpl != null) {
|
||||
viewRootImpl.releasePointerCapture(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the capture status of mouse events.
|
||||
*
|
||||
* @return true if the view has the capture.
|
||||
* @see #requestPointerCapture()
|
||||
* @see #hasPointerCapture()
|
||||
*/
|
||||
public boolean hasPointerCapture() {
|
||||
final ViewRootImpl viewRootImpl = getViewRootImpl();
|
||||
return (viewRootImpl != null) && viewRootImpl.hasPointerCapture(this);
|
||||
}
|
||||
|
||||
//
|
||||
// Properties
|
||||
//
|
||||
|
||||
@@ -3168,32 +3168,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
}
|
||||
|
||||
void requestPointerCapture(View view) {
|
||||
if (!mAttachInfo.mHasWindowFocus) {
|
||||
Log.w(mTag, "Can't set capture if it's not focused.");
|
||||
return;
|
||||
}
|
||||
if (mCapturingView == view) {
|
||||
return;
|
||||
}
|
||||
mCapturingView = view;
|
||||
InputManager.getInstance().setPointerIconDetached(true);
|
||||
return;
|
||||
}
|
||||
|
||||
void releasePointerCapture(View view) {
|
||||
if (mCapturingView != view || mCapturingView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCapturingView = null;
|
||||
InputManager.getInstance().setPointerIconDetached(false);
|
||||
}
|
||||
|
||||
boolean hasPointerCapture(View view) {
|
||||
return view != null && mCapturingView == view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestChildFocus(View child, View focused) {
|
||||
if (DEBUG_INPUT_RESIZE) {
|
||||
@@ -3271,10 +3245,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mView = null;
|
||||
mAttachInfo.mRootView = null;
|
||||
|
||||
if (mCapturingView != null) {
|
||||
releasePointerCapture(mCapturingView);
|
||||
}
|
||||
|
||||
mSurface.release();
|
||||
|
||||
if (mInputQueueCallback != null && mInputQueue != null) {
|
||||
@@ -3615,8 +3585,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
.softInputMode &=
|
||||
~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION;
|
||||
mHasHadWindowFocus = true;
|
||||
} else if (mCapturingView != null) {
|
||||
releasePointerCapture(mCapturingView);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
@@ -90,7 +90,6 @@ PointerController::PointerController(const sp<PointerControllerPolicyInterface>&
|
||||
mLocked.lastFrameUpdatedTime = 0;
|
||||
|
||||
mLocked.buttonState = 0;
|
||||
mLocked.iconDetached = false;
|
||||
|
||||
mPolicy->loadPointerIcon(&mLocked.pointerIcon);
|
||||
|
||||
@@ -185,10 +184,6 @@ void PointerController::setPosition(float x, float y) {
|
||||
}
|
||||
|
||||
void PointerController::setPositionLocked(float x, float y) {
|
||||
if (mLocked.iconDetached) {
|
||||
return;
|
||||
}
|
||||
|
||||
float minX, minY, maxX, maxY;
|
||||
if (getBoundsLocked(&minX, &minY, &maxX, &maxY)) {
|
||||
if (x <= minX) {
|
||||
@@ -222,10 +217,6 @@ void PointerController::fade(Transition transition) {
|
||||
// Remove the inactivity timeout, since we are fading now.
|
||||
removeInactivityTimeoutLocked();
|
||||
|
||||
if (mLocked.iconDetached) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Start fading.
|
||||
if (transition == TRANSITION_IMMEDIATE) {
|
||||
mLocked.pointerFadeDirection = 0;
|
||||
@@ -243,10 +234,6 @@ void PointerController::unfade(Transition transition) {
|
||||
// Always reset the inactivity timer.
|
||||
resetInactivityTimeoutLocked();
|
||||
|
||||
if (mLocked.iconDetached) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Start unfading.
|
||||
if (transition == TRANSITION_IMMEDIATE) {
|
||||
mLocked.pointerFadeDirection = 0;
|
||||
@@ -362,22 +349,6 @@ void PointerController::reloadPointerResources() {
|
||||
updatePointerLocked();
|
||||
}
|
||||
|
||||
void PointerController::detachPointerIcon(bool detached) {
|
||||
AutoMutex _l(mLock);
|
||||
|
||||
if (mLocked.iconDetached == detached) {
|
||||
return;
|
||||
}
|
||||
|
||||
mLocked.iconDetached = detached;
|
||||
if (detached) {
|
||||
mLocked.pointerFadeDirection = -1;
|
||||
} else {
|
||||
mLocked.pointerFadeDirection = 1;
|
||||
}
|
||||
startAnimationLocked();
|
||||
}
|
||||
|
||||
void PointerController::setDisplayViewport(int32_t width, int32_t height, int32_t orientation) {
|
||||
AutoMutex _l(mLock);
|
||||
|
||||
|
||||
@@ -111,10 +111,6 @@ public:
|
||||
void setInactivityTimeout(InactivityTimeout inactivityTimeout);
|
||||
void reloadPointerResources();
|
||||
|
||||
/* Detach or attach the pointer icon status. When detached, the pointer icon disappears
|
||||
* and the icon location does not change at all. */
|
||||
void detachPointerIcon(bool detached);
|
||||
|
||||
private:
|
||||
static const size_t MAX_RECYCLED_SPRITES = 12;
|
||||
static const size_t MAX_SPOTS = 12;
|
||||
@@ -184,8 +180,6 @@ private:
|
||||
|
||||
int32_t buttonState;
|
||||
|
||||
bool iconDetached;
|
||||
|
||||
Vector<Spot*> spots;
|
||||
Vector<sp<Sprite> > recycledSprites;
|
||||
} mLocked;
|
||||
|
||||
@@ -222,7 +222,6 @@ public class InputManagerService extends IInputManager.Stub
|
||||
private static native void nativeSetPointerIconType(long ptr, int iconId);
|
||||
private static native void nativeReloadPointerIcons(long ptr);
|
||||
private static native void nativeSetCustomPointerIcon(long ptr, PointerIcon icon);
|
||||
private static native void nativeSetPointerIconDetached(long ptr, boolean detached);
|
||||
|
||||
// Input event injection constants defined in InputDispatcher.h.
|
||||
private static final int INPUT_EVENT_INJECTION_SUCCEEDED = 0;
|
||||
@@ -1503,11 +1502,6 @@ public class InputManagerService extends IInputManager.Stub
|
||||
nativeSetFocusedApplication(mPtr, application);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPointerIconDetached(boolean detached) {
|
||||
nativeSetPointerIconDetached(mPtr, detached);
|
||||
}
|
||||
|
||||
public void setInputDispatchMode(boolean enabled, boolean frozen) {
|
||||
nativeSetInputDispatchMode(mPtr, enabled, frozen);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,6 @@ public:
|
||||
void setPointerIconType(int32_t iconId);
|
||||
void reloadPointerIcons();
|
||||
void setCustomPointerIcon(const SpriteIcon& icon);
|
||||
void setPointerIconDetached(bool detached);
|
||||
|
||||
/* --- InputReaderPolicyInterface implementation --- */
|
||||
|
||||
@@ -712,14 +711,6 @@ void NativeInputManager::setFocusedApplication(JNIEnv* env, jobject applicationH
|
||||
mInputManager->getDispatcher()->setFocusedApplication(applicationHandle);
|
||||
}
|
||||
|
||||
void NativeInputManager::setPointerIconDetached(bool detached) {
|
||||
AutoMutex _l(mLock);
|
||||
sp<PointerController> controller = mLocked.pointerController.promote();
|
||||
if (controller != NULL) {
|
||||
controller->detachPointerIcon(detached);
|
||||
}
|
||||
}
|
||||
|
||||
void NativeInputManager::setInputDispatchMode(bool enabled, bool frozen) {
|
||||
mInputManager->getDispatcher()->setInputDispatchMode(enabled, frozen);
|
||||
}
|
||||
@@ -1332,12 +1323,6 @@ static void nativeSetFocusedApplication(JNIEnv* env, jclass /* clazz */,
|
||||
im->setFocusedApplication(env, applicationHandleObj);
|
||||
}
|
||||
|
||||
static void nativeSetPointerIconDetached(JNIEnv* env, jclass /* clazz */, jlong ptr,
|
||||
jboolean detached) {
|
||||
NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
|
||||
im->setPointerIconDetached(detached);
|
||||
}
|
||||
|
||||
static void nativeSetInputDispatchMode(JNIEnv* /* env */,
|
||||
jclass /* clazz */, jlong ptr, jboolean enabled, jboolean frozen) {
|
||||
NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
|
||||
@@ -1520,8 +1505,6 @@ static const JNINativeMethod gInputManagerMethods[] = {
|
||||
(void*) nativeSetInputWindows },
|
||||
{ "nativeSetFocusedApplication", "(JLcom/android/server/input/InputApplicationHandle;)V",
|
||||
(void*) nativeSetFocusedApplication },
|
||||
{ "nativeSetPointerIconDetached", "(JZ)V",
|
||||
(void*) nativeSetPointerIconDetached },
|
||||
{ "nativeSetInputDispatchMode", "(JZZ)V",
|
||||
(void*) nativeSetInputDispatchMode },
|
||||
{ "nativeSetSystemUiVisibility", "(JI)V",
|
||||
|
||||
Reference in New Issue
Block a user