JSTouchDispatcher.smali
.class public Lcom/facebook/react/uimanager/JSTouchDispatcher;
.super Ljava/lang/Object;
.source "SourceFile"
# instance fields
.field private mChildIsHandlingNativeGesture:Z
.field private mGestureStartTime:J
.field private final mRootViewGroup:Landroid/view/ViewGroup;
.field private final mTargetCoordinates:[F
.field private mTargetTag:I
.field private final mTouchEventCoalescingKeyHelper:Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;
# direct methods
.method public constructor <init>(Landroid/view/ViewGroup;)V
.registers 4
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/4 v0, -0x1
.line 2
iput v0, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
const/4 v0, 0x2
new-array v0, v0, [F
.line 3
iput-object v0, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetCoordinates:[F
const/4 v0, 0x0
.line 4
iput-boolean v0, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mChildIsHandlingNativeGesture:Z
const-wide/high16 v0, -0x8000000000000000L
.line 5
iput-wide v0, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mGestureStartTime:J
.line 6
new-instance v0, Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;
invoke-direct {v0}, Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;-><init>()V
iput-object v0, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTouchEventCoalescingKeyHelper:Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;
.line 7
iput-object p1, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mRootViewGroup:Landroid/view/ViewGroup;
return-void
.end method
.method private dispatchCancelEvent(Landroid/view/MotionEvent;Lcom/facebook/react/uimanager/events/EventDispatcher;)V
.registers 13
.line 1
iget v0, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
const/4 v1, -0x1
if-ne v0, v1, :cond_d
const-string p1, "ReactNative"
const-string p2, "Can\'t cancel already finished gesture. Is a child View trying to start a gesture from an UP/CANCEL event?"
.line 2
invoke-static {p1, p2}, Lcom/facebook/common/logging/FLog;->w(Ljava/lang/String;Ljava/lang/String;)V
return-void
.line 3
:cond_d
iget-boolean v0, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mChildIsHandlingNativeGesture:Z
const/4 v1, 0x1
xor-int/2addr v0, v1
const-string v2, "Expected to not have already sent a cancel for this gesture"
invoke-static {v0, v2}, Lcom/facebook/infer/annotation/Assertions;->assertCondition(ZLjava/lang/String;)V
.line 4
invoke-static {p2}, Lcom/facebook/infer/annotation/Assertions;->assertNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p2
check-cast p2, Lcom/facebook/react/uimanager/events/EventDispatcher;
iget v2, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
sget-object v3, Lcom/facebook/react/uimanager/events/TouchEventType;->CANCEL:Lcom/facebook/react/uimanager/events/TouchEventType;
iget-wide v5, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mGestureStartTime:J
iget-object v0, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetCoordinates:[F
const/4 v4, 0x0
aget v7, v0, v4
aget v8, v0, v1
iget-object v9, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTouchEventCoalescingKeyHelper:Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;
move-object v4, p1
.line 5
invoke-static/range {v2 .. v9}, Lcom/facebook/react/uimanager/events/TouchEvent;->obtain(ILcom/facebook/react/uimanager/events/TouchEventType;Landroid/view/MotionEvent;JFFLcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;)Lcom/facebook/react/uimanager/events/TouchEvent;
move-result-object p1
.line 6
invoke-virtual {p2, p1}, Lcom/facebook/react/uimanager/events/EventDispatcher;->dispatchEvent(Lcom/facebook/react/uimanager/events/Event;)V
return-void
.end method
.method private findTargetTagAndSetCoordinates(Landroid/view/MotionEvent;)I
.registers 6
.line 1
invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F
move-result v0
invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F
move-result p1
iget-object v1, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mRootViewGroup:Landroid/view/ViewGroup;
iget-object v2, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetCoordinates:[F
const/4 v3, 0x0
.line 2
invoke-static {v0, p1, v1, v2, v3}, Lcom/facebook/react/uimanager/TouchTargetHelper;->findTargetTagAndCoordinatesForTouch(FFLandroid/view/ViewGroup;[F[I)I
move-result p1
return p1
.end method
# virtual methods
.method public handleTouchEvent(Landroid/view/MotionEvent;Lcom/facebook/react/uimanager/events/EventDispatcher;)V
.registers 22
move-object/from16 v0, p0
move-object/from16 v1, p2
.line 1
invoke-virtual/range {p1 .. p1}, Landroid/view/MotionEvent;->getAction()I
move-result v2
and-int/lit16 v2, v2, 0xff
const-string v3, "ReactNative"
const/4 v4, -0x1
const/4 v5, 0x1
const/4 v6, 0x0
if-nez v2, :cond_3f
.line 2
iget v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
if-eq v2, v4, :cond_1a
const-string v2, "Got DOWN touch before receiving UP or CANCEL from last gesture"
.line 3
invoke-static {v3, v2}, Lcom/facebook/common/logging/FLog;->e(Ljava/lang/String;Ljava/lang/String;)V
.line 4
:cond_1a
iput-boolean v6, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mChildIsHandlingNativeGesture:Z
.line 5
invoke-virtual/range {p1 .. p1}, Landroid/view/MotionEvent;->getEventTime()J
move-result-wide v2
iput-wide v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mGestureStartTime:J
.line 6
invoke-direct/range {p0 .. p1}, Lcom/facebook/react/uimanager/JSTouchDispatcher;->findTargetTagAndSetCoordinates(Landroid/view/MotionEvent;)I
move-result v7
iput v7, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
.line 7
sget-object v8, Lcom/facebook/react/uimanager/events/TouchEventType;->START:Lcom/facebook/react/uimanager/events/TouchEventType;
iget-wide v10, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mGestureStartTime:J
iget-object v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetCoordinates:[F
aget v12, v2, v6
aget v13, v2, v5
iget-object v14, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTouchEventCoalescingKeyHelper:Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;
move-object/from16 v9, p1
.line 8
invoke-static/range {v7 .. v14}, Lcom/facebook/react/uimanager/events/TouchEvent;->obtain(ILcom/facebook/react/uimanager/events/TouchEventType;Landroid/view/MotionEvent;JFFLcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;)Lcom/facebook/react/uimanager/events/TouchEvent;
move-result-object v2
.line 9
invoke-virtual {v1, v2}, Lcom/facebook/react/uimanager/events/EventDispatcher;->dispatchEvent(Lcom/facebook/react/uimanager/events/Event;)V
goto/16 :goto_f8
.line 10
:cond_3f
iget-boolean v7, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mChildIsHandlingNativeGesture:Z
if-eqz v7, :cond_44
return-void
.line 11
:cond_44
iget v8, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
if-ne v8, v4, :cond_4f
const-string v1, "Unexpected state: received touch event but didn\'t get starting ACTION_DOWN for this gesture before"
.line 12
invoke-static {v3, v1}, Lcom/facebook/common/logging/FLog;->e(Ljava/lang/String;Ljava/lang/String;)V
goto/16 :goto_f8
:cond_4f
const-wide/high16 v9, -0x8000000000000000L
if-ne v2, v5, :cond_75
.line 13
invoke-direct/range {p0 .. p1}, Lcom/facebook/react/uimanager/JSTouchDispatcher;->findTargetTagAndSetCoordinates(Landroid/view/MotionEvent;)I
.line 14
iget v11, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
sget-object v12, Lcom/facebook/react/uimanager/events/TouchEventType;->END:Lcom/facebook/react/uimanager/events/TouchEventType;
iget-wide v14, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mGestureStartTime:J
iget-object v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetCoordinates:[F
aget v16, v2, v6
aget v17, v2, v5
iget-object v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTouchEventCoalescingKeyHelper:Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;
move-object/from16 v13, p1
move-object/from16 v18, v2
.line 15
invoke-static/range {v11 .. v18}, Lcom/facebook/react/uimanager/events/TouchEvent;->obtain(ILcom/facebook/react/uimanager/events/TouchEventType;Landroid/view/MotionEvent;JFFLcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;)Lcom/facebook/react/uimanager/events/TouchEvent;
move-result-object v2
.line 16
invoke-virtual {v1, v2}, Lcom/facebook/react/uimanager/events/EventDispatcher;->dispatchEvent(Lcom/facebook/react/uimanager/events/Event;)V
.line 17
iput v4, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
.line 18
iput-wide v9, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mGestureStartTime:J
goto/16 :goto_f8
:cond_75
const/4 v7, 0x2
if-ne v2, v7, :cond_95
.line 19
invoke-direct/range {p0 .. p1}, Lcom/facebook/react/uimanager/JSTouchDispatcher;->findTargetTagAndSetCoordinates(Landroid/view/MotionEvent;)I
.line 20
iget v11, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
sget-object v12, Lcom/facebook/react/uimanager/events/TouchEventType;->MOVE:Lcom/facebook/react/uimanager/events/TouchEventType;
iget-wide v14, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mGestureStartTime:J
iget-object v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetCoordinates:[F
aget v16, v2, v6
aget v17, v2, v5
iget-object v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTouchEventCoalescingKeyHelper:Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;
move-object/from16 v13, p1
move-object/from16 v18, v2
.line 21
invoke-static/range {v11 .. v18}, Lcom/facebook/react/uimanager/events/TouchEvent;->obtain(ILcom/facebook/react/uimanager/events/TouchEventType;Landroid/view/MotionEvent;JFFLcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;)Lcom/facebook/react/uimanager/events/TouchEvent;
move-result-object v2
.line 22
invoke-virtual {v1, v2}, Lcom/facebook/react/uimanager/events/EventDispatcher;->dispatchEvent(Lcom/facebook/react/uimanager/events/Event;)V
goto :goto_f8
:cond_95
const/4 v7, 0x5
if-ne v2, v7, :cond_ae
.line 23
sget-object v9, Lcom/facebook/react/uimanager/events/TouchEventType;->START:Lcom/facebook/react/uimanager/events/TouchEventType;
iget-wide v11, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mGestureStartTime:J
iget-object v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetCoordinates:[F
aget v13, v2, v6
aget v14, v2, v5
iget-object v15, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTouchEventCoalescingKeyHelper:Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;
move-object/from16 v10, p1
.line 24
invoke-static/range {v8 .. v15}, Lcom/facebook/react/uimanager/events/TouchEvent;->obtain(ILcom/facebook/react/uimanager/events/TouchEventType;Landroid/view/MotionEvent;JFFLcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;)Lcom/facebook/react/uimanager/events/TouchEvent;
move-result-object v2
.line 25
invoke-virtual {v1, v2}, Lcom/facebook/react/uimanager/events/EventDispatcher;->dispatchEvent(Lcom/facebook/react/uimanager/events/Event;)V
goto :goto_f8
:cond_ae
const/4 v7, 0x6
if-ne v2, v7, :cond_c7
.line 26
sget-object v9, Lcom/facebook/react/uimanager/events/TouchEventType;->END:Lcom/facebook/react/uimanager/events/TouchEventType;
iget-wide v11, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mGestureStartTime:J
iget-object v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetCoordinates:[F
aget v13, v2, v6
aget v14, v2, v5
iget-object v15, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTouchEventCoalescingKeyHelper:Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;
move-object/from16 v10, p1
.line 27
invoke-static/range {v8 .. v15}, Lcom/facebook/react/uimanager/events/TouchEvent;->obtain(ILcom/facebook/react/uimanager/events/TouchEventType;Landroid/view/MotionEvent;JFFLcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;)Lcom/facebook/react/uimanager/events/TouchEvent;
move-result-object v2
.line 28
invoke-virtual {v1, v2}, Lcom/facebook/react/uimanager/events/EventDispatcher;->dispatchEvent(Lcom/facebook/react/uimanager/events/Event;)V
goto :goto_f8
:cond_c7
const/4 v5, 0x3
if-ne v2, v5, :cond_e4
.line 29
iget-object v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTouchEventCoalescingKeyHelper:Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;
invoke-virtual/range {p1 .. p1}, Landroid/view/MotionEvent;->getDownTime()J
move-result-wide v5
invoke-virtual {v2, v5, v6}, Lcom/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper;->hasCoalescingKey(J)Z
move-result v2
if-eqz v2, :cond_da
.line 30
invoke-direct/range {p0 .. p2}, Lcom/facebook/react/uimanager/JSTouchDispatcher;->dispatchCancelEvent(Landroid/view/MotionEvent;Lcom/facebook/react/uimanager/events/EventDispatcher;)V
goto :goto_df
:cond_da
const-string v1, "Received an ACTION_CANCEL touch event for which we have no corresponding ACTION_DOWN"
.line 31
invoke-static {v3, v1}, Lcom/facebook/common/logging/FLog;->e(Ljava/lang/String;Ljava/lang/String;)V
.line 32
:goto_df
iput v4, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
.line 33
iput-wide v9, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mGestureStartTime:J
goto :goto_f8
:cond_e4
const-string v1, "Warning : touch event was ignored. Action="
const-string v4, " Target="
.line 34
invoke-static {v1, v2, v4}, Landroidx/core/content/c;->g(Ljava/lang/String;ILjava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
.line 35
iget v2, v0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v3, v1}, Lcom/facebook/common/logging/FLog;->w(Ljava/lang/String;Ljava/lang/String;)V
:goto_f8
return-void
.end method
.method public onChildStartedNativeGesture(Landroid/view/MotionEvent;Lcom/facebook/react/uimanager/events/EventDispatcher;)V
.registers 4
.line 1
iget-boolean v0, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mChildIsHandlingNativeGesture:Z
if-eqz v0, :cond_5
return-void
.line 2
:cond_5
invoke-direct {p0, p1, p2}, Lcom/facebook/react/uimanager/JSTouchDispatcher;->dispatchCancelEvent(Landroid/view/MotionEvent;Lcom/facebook/react/uimanager/events/EventDispatcher;)V
const/4 p1, 0x1
.line 3
iput-boolean p1, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mChildIsHandlingNativeGesture:Z
const/4 p1, -0x1
.line 4
iput p1, p0, Lcom/facebook/react/uimanager/JSTouchDispatcher;->mTargetTag:I
return-void
.end method