致命信号11(SIGSEGV),代码1,故障地址(RenderThread)

时间:2015-02-21 20:48:46

标签: android service crash

我试图在连接到windowmanager的元素被双击时停止服务。

                @Override public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:

                    // Get current time in nano seconds.
                    long pressTime = System.currentTimeMillis();


                    // If double click...
                    if (pressTime - lastPressTime <= 300) {
                        createNotification();
                        ServiceFloating.this.stopSelf();
                        mHasDoubleClicked = true;
                    }
                    else {     // If not double click....
                        mHasDoubleClicked = false;
                    }
                    lastPressTime = pressTime; 
                    initialX = paramsF.x;
                    initialY = paramsF.y;
                    initialTouchX = event.getRawX();
                    initialTouchY = event.getRawY();
                    break;
                case MotionEvent.ACTION_UP:
                        if(event.getRawX() - initialTouchX >40)
                    {
                        paramsF.x = (int)dispwidth;
                        paramsF.y = initialY + (int) (event.getRawY() - initialTouchY);
                        ObjectAnimator animY = ObjectAnimator.ofFloat(layout, "translationX", 100f, 0f);
                        animY.setDuration(1000);//1sec
                        animY.setInterpolator(new BounceInterpolator());
                        animY.setRepeatCount(0);
                        animY.start();
                    }
                    else if(initialTouchX-event.getRawX()>40){
                        paramsF.x = 0;
                        paramsF.y = initialY + (int) (event.getRawY() - initialTouchY);
                        ObjectAnimator animY = ObjectAnimator.ofFloat(layout, "translationX", -100f, 0f);
                        animY.setDuration(1000);//1sec
                        animY.setInterpolator(new BounceInterpolator());
                        animY.setRepeatCount(0);
                        animY.start();
                    }
                    windowManager.updateViewLayout(layout, paramsF);
                    break;
                case MotionEvent.ACTION_MOVE:
                    paramsF.x = initialX + (int) (event.getRawX() - initialTouchX);
                    paramsF.y = initialY + (int) (event.getRawY() - initialTouchY);
                    windowManager.updateViewLayout(layout, paramsF);
                    break;
                }
                return false;
            }
        });
    } catch (Exception e) {
        // TODO: handle exception
    }

但是一旦元素被双击,应用程序就会在logcat中崩溃:

  

swapBuffers在0xb8f18fb0上遇到EGL_BAD_SURFACE,暂停渲染......   02-22 01:38:26.189 7191-7213 / fr.anthonyfernandez.floatingmenu W / Adreno-EGLSUB :: dequeue native buffer failed:没有这样的设备,buffer = 0x0,handle = 0x0   02-22 01:38:26.189 7191-7213 / fr.anthonyfernandez.floatingmenu W / Adreno-EGLSUB :: dequeue native buffer failed:没有这样的设备,buffer = 0x0,handle = 0x0   02-22 01:38:26.189 7191-7213 / fr.anthonyfernandez.floatingmenu W / Adreno-EGL :: EGL_BAD_SURFACE   02-22 01:38:26.189 7191-7213 / fr.anthonyfernandez.floatingmenu W / OpenGLRenderer:swapBuffers在0xb8916958上遇到EGL_BAD_SURFACE,暂停渲染......   02-22 01:38:26.221 7191-7213 / fr.anthonyfernandez.floatingmenu A / libc:致命信号11(SIGSEGV),代码1,故障地址0x54 in tid 7213(RenderThread)

0 个答案:

没有答案