Android 3.0 drag-n-drop IllegalArgumentException after 30 actions

295 views
Skip to first unread message

Dmitriy_Boichenko

unread,
Sep 12, 2011, 8:24:48 AM9/12/11
to android-platform
I'm working with android 3.0 drag-n-drop framework. All works fine.
But after 30 actions application causes IllegalArgumentException.

09-12 11:17:32.282: WARN/Surface(31132): Not initializing the
shared buffer client because token = -12
09-12 11:17:32.282: ERROR/View(31132): Unable to initiate drag
09-12 11:17:32.282: ERROR/View(31132):
java.lang.IllegalArgumentException
09-12 11:17:32.282: ERROR/View(31132): at
android.view.Surface.lockCanvasNative(Native Method)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.Surface.lockCanvas(Surface.java:350)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.View.startDrag(View.java:11467)
09-12 11:17:32.282: ERROR/View(31132): at
com.example.drag.drop.Dot$1.onTouch(Dot.java:70)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.View.dispatchTouchEvent(View.java:4605)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:
1560)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1291)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:
1560)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1291)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:
1560)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1291)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:
1560)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1291)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:
1560)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1291)
09-12 11:17:32.282: ERROR/View(31132): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.superDispatchTouchEvent(PhoneWindow.java:1709)
09-12 11:17:32.282: ERROR/View(31132): at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:
1264)
09-12 11:17:32.282: ERROR/View(31132): at
android.app.Activity.dispatchTouchEvent(Activity.java:2315)
09-12 11:17:32.282: ERROR/View(31132): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchTouchEvent(PhoneWindow.java:1682)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.View.dispatchPointerEvent(View.java:4677)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2392)
09-12 11:17:32.282: ERROR/View(31132): at
android.view.ViewRoot.handleMessage(ViewRoot.java:2054)
09-12 11:17:32.282: ERROR/View(31132): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-12 11:17:32.282: ERROR/View(31132): at
android.os.Looper.loop(Looper.java:132)
09-12 11:17:32.282: ERROR/View(31132): at
android.app.ActivityThread.main(ActivityThread.java:4123)
09-12 11:17:32.282: ERROR/View(31132): at
java.lang.reflect.Method.invokeNative(Native Method)
09-12 11:17:32.282: ERROR/View(31132): at
java.lang.reflect.Method.invoke(Method.java:491)
09-12 11:17:32.282: ERROR/View(31132): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:841)
09-12 11:17:32.282: ERROR/View(31132): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
09-12 11:17:32.282: ERROR/View(31132): at
dalvik.system.NativeStart.main(Native Method)
09-12 11:17:34.272: WARN/WindowManager(4050): Drag already in
progress
09-12 11:17:34.622: WARN/WindowManager(4050): Drag already in
progress
09-12 11:17:34.912: WARN/WindowManager(4050): Drag already in
progress
09-12 11:17:35.462: WARN/WindowManager(4050): Drag already in
progress
09-12 11:17:35.782: WARN/WindowManager(4050): Drag already in
progress
09-12 11:17:37.282: ERROR/WindowManager(4050): Unregister of
nonexistent drag input channel

Application again works fine after dalvinkvm calls for each DragEvent

09-12 11:18:06.662: WARN/Surface(31132): Surface.finalize() has
work. You should have called release() (1720472, 0)

As you can see time delay between exception and finalization is
approximately 30 sec.

Same exception occurs on two example projects from books:

1)http://www.manning.com/collins/; example on chapter 15:
http://www.manning-sandbox.com/thread.jspa?messageID=117809&tstart=0

2)http://www.apress.com/9781430232223; example on chapter 31

Question:

1)How finalize DragEvents properly?

or


2)How call Surface.finalize() if I'm working with GridView for
example?

Thanks.

Christopher Tate

unread,
Sep 13, 2011, 5:01:10 PM9/13/11
to android-...@googlegroups.com
This is a bug in the 3.x framework code, I'm afraid.  You might be able to work around it by explicitly invoking a garbage collection pass in your app in response to the drag-ended message; this should encourage the unreleased Surface instances to be cleaned up more aggressively so you don't wind up running out of available slots.

--
christopher tate
android framework engineer



--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


Dmitriy_Boichenko

unread,
Sep 15, 2011, 3:26:28 AM9/15/11
to android-platform
Thank you to response.

I didn't resolve this problem.
I have got round this problem by window redraw. It leads to perform
collecting of drags.
Window will be redrawn after soft keyboard opened or some ImageView
updated or something like this.

Thanks
Reply all
Reply to author
Forward
0 new messages