提出的bug:專業模式,橫屏狀態下,點擊縮略圖,進入圖庫,下滑圖片回傳camera,快速按住 shutterButton 持續約 1S 左右,松開, shutter 的 狀態 仍 顯示為 按住的 狀態,
log中輸出的關鍵資訊:
Line 52764: 12-07 16:24:14.496 23868 23868 V ViewRootImpl[Camera]: enqueueInputEvent: event = MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2026.0, y[0]=579.75, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=95786318, downTime=95786118, deviceId=4, source=0x1002, displayId=0, eventId=14271986 },processImmediately = true,mProcessInputEventsScheduled = false, this = android.view.ViewRootImpl@f312c09
Line 52764: 12-07 16:24:14.496 23868 23868 V ViewRootImpl[Camera]: enqueueInputEvent: event = MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2026.0, y[0]=579.75, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=95786318, downTime=95786118, deviceId=4, source=0x1002, displayId=0, eventId=14271986 },processImmediately = true,mProcessInputEventsScheduled = false, this
Line 52816: 12-07 16:24:14.505 23868 23900 I BufferQueueProducer: [ViewRootImpl[Camera]#59(BLAST Consumer)59](id:5d3c000000ae,api:1,p:23868,c:23868) disconnect: api 1
Line 52828: 12-07 16:24:14.506 23868 23900 I BufferQueueProducer: [ViewRootImpl[Camera]#59(BLAST Consumer)59](id:5d3c000000ae,api:1,p:23868,c:23868) connect: api=1 producerControlledByApp=true
Line 52890: 12-07 16:24:14.508 23868 23868 V ViewRootImpl[Camera]: enqueueInputEvent: event = MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=2026.0, y[0]=579.75, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=95786331, downTime=95786118, deviceId=4, source=0x1002, displayId=0, eventId=1797847677 },processImmediately = true,mProcessInputEventsScheduled = false, this = android.view.ViewRootImpl@f312c09
Line 52890: 12-07 16:24:14.508 23868 23868 V ViewRootImpl[Camera]: enqueueInputEvent: event = MotionEvent { action=
Line 52894: 12-07 16:24:14.508 23868 23868 E gaorui : CameraManager - handleEdgeTouch - return
Line 52897: 12-07 16:24:14.509 23868 23868 E gaorui : Camera - dispatchTouchEvent - (m.getX() ) = 2026.0
Line 52899: 12-07 16:24:14.509 23868 23868 E gaorui : Camera - dispatchTouchEvent - (m.getX() < 0) = false
Line 52900: 12-07 16:24:14.509 23868 23868 E gaorui : Camera - dispatchTouchEvent - (m.getY() < 0) = false
Line 52901: 12-07 16:24:14.509 23868 23868 E gaorui : Camera - dispatchTouchEvent - (m.getX() ) = 2026.0
Line 52902: 12-07 16:24:14.509 23868 23868 E gaorui : Camera - dispatchTouchEvent - Util.getScreenWidth() = 1080
Line 52903: 12-07 16:24:14.509 23868 23868 E gaorui : Camera - dispatchTouchEvent - return - 2
剛開始的懷疑點是: 橫屏 狀態下 觸摸一個地方 與 豎屏狀態下 觸摸 同一個地方,顯示的坐標是一樣的,唯獨 發生例外的 時候,接收到的 InputEvent 是 錯誤的,導致camera 直接退出 接收 按鍵的狀態,所以無法回應接下來的 Up 事件,所以 去 詢問了 frameWork 的同事,后來 提出 是不是 camera 再進入 的時候 重新 進行 二次布局,而觸摸發送的坐標 是布局之前的,
于是就繼續 查查 camera 中是否 會對 螢屏坐標系 進行 變換,(對于 螢屏坐標系 不是怎么熟悉的各位可以看看這個鏈接里的),
這個推測原因很快被否定了,因為 在 例外發生的時候,狀態欄 會再次出現,并且是橫屏的狀態,由此可見,此時 系統 還沒有轉過來 坐標,
最后解決辦法就是,在接收到例外坐標的時候,將其再次置換回去,action 的話,可以選擇 將其改成 down 事件,或者 不改變action,直接 執行 cancel事件,
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/402767.html
標籤:其他
