0

I have this problem on some devices and on some occasions, and I can't reproduce it 100%. Sometimes when the user switches away from my activity they get this error: Activity reported stop, but no longer stopping: ActivityRecord and usually it's followed by an ANR like:

02-26 19:43:31.187 I/InputDispatcher( 1062): Application is not responding: Window{8f7e457 u0 gb.xxy.hr/gb.xxy.hr.player}.  It has been 5000.8ms since event, 5000.6ms since wait started.  Reason: Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 14.  Wait queue head age: 6964.8ms.
02-26 19:43:31.208 I/WindowManager( 1062): Input event dispatching timed out sending to gb.xxy.hr/gb.xxy.hr.player.  Reason: Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 14.  Wait queue head age: 6964.8ms.
02-26 19:43:31.270 E/ActivityManager( 1062): ANR in gb.xxy.hr (gb.xxy.hr/.player)
02-26 19:43:31.270 E/ActivityManager( 1062): PID: 14732
02-26 19:43:31.270 E/ActivityManager( 1062): Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 14.  Wait queue head age: 6964.8ms.)
02-26 19:43:31.270 E/ActivityManager( 1062): Load: 0.0 / 0.0 / 0.0
02-26 19:43:31.270 E/ActivityManager( 1062): CPU usage from 179169ms to 0ms ago (2019-02-26 19:40:32.074 to 2019-02-26 19:43:31.243):

My activity onstop has no code in it, but I do have some code which releases the surface:

@Override
public void surfaceDestroyed(SurfaceHolder holder) {
    myLog.d(TAG,"Surface Destroyed.");
    try {
        holder.removeCallback(this);

        holder.getSurface().release();

    }
    catch (Exception e)
    {
        myLog.e(TAG,e.getMessage());
    }
    videoexecutor.shutdownNow();
    visible=false;
    m_codec.stop();
    m_codec.release();
    m_codec=null;


}

I did had a look at a similar question: Android onStop times out despite doing no work and I do think that this is somehow caused by the surface but I cannot figure it out what is actually causing it, and why not on all devices and not all the time....

Any thoughts?

Emil Borconi
  • 3,326
  • 2
  • 24
  • 40
  • There's actually a good amount of things that can be done that have even seemingly random problems on specific devices or all. Not really surprising. It might take months to figure out. Sometimes it's just doing it differently that fixes the problem, other times something else. The problem here is you're handing over the lifecycle into other hands and a timeout there can potentially stop your app. Maybe this will help etc other ways of dealing with the surface (see the last answer) https://stackoverflow.com/questions/5318847/android-crash-when-app-is-closed-and-reopened – CmosBattery Feb 26 '19 at 21:26
  • @CmosBattery thanks for that, haven't seen it before, yes there looks to be some hint there. This is actually helpful. Thank you. – Emil Borconi Feb 27 '19 at 00:03

0 Answers0