0

For some strange reason, which I'm not entirely sure why, I'm getting not only an ANR for my application, but also of the entire systemui. It's so bad that I HAVE to reboot, and after rebooting it has to "Optimize" all of my apps like it corrupted something (anyone have an explanation as to why this happens?).

I'm assuming that parts of my code are so bad that they're causing this, but should even malicious code be able to overload the systemui? Anyway...

What I am doing is that I'm attempting to launch a service to handle screen recording. The activity (from a fragment) asks for permission (which is obtained, and I see the Screencast icon in the top right corner of the screen), then it binds a service which handles any state changes. What I mean by state changes is this...

States:

  • Dead - Means it needs to be initialized and prepared
  • Alive - Means it needs to be start and is fully initialized/prepared
  • Started - Means it is currently recording.
  • Paused - Means it will start a new video after starting again, which it will combine all temporary videos into one (haven't worked out that details yet).
  • Stopped - Means combine any and all files into one, then send the URI through an intent in a broadcast (haven't gotten this far yet).

It goes from Dead -> Alive -> Started <-> Paused -> Stopped -> Dead. At least that's the overall plan. I plan on having a floating button that acts as remote for controlling the service, and hence broadcasting on a receiver (local) to my fragment which is waiting for it to be finished.

Now, enough of what I intend to have, lets get into what I have right now. It's kind of a mess, I've never done this stuff before, hence why I'm asking on here. Trust me when I say that I have tried a lot of stuff, and the unfortunate bit is, the only way to test out a new solution is to reboot and wait 15 minutes while Android optimizes everything again. Now I understand it's a "Long" code-segment, but I'll say that one place it crashes is stopRecording(), at line 216.

Code here.

Let me know if I should make any changes.

Lastly: Should any of this be run on another thread? Could that be the issue? Why doesn't the app crash only instead of systemui?

Louis Jenkins
  • 391
  • 1
  • 2
  • 10
  • Should also note that Chorographer noted that it had to skip almost 10,000 frames(!!!), but I'm not sure if that's my app blocking somewhere, or the systemui. – Louis Jenkins Nov 15 '15 at 01:10
  • Also should note, no, I am not rooted, and no I do not have a custom ROM. – Louis Jenkins Nov 15 '15 at 01:24
  • So, I decided to test things out on my phone, an LG G4, rather than my tablet, the Nexus 7. Everything is actually working fine on the LG G4, yet causes a system crash on my tablet. What is going on? – Louis Jenkins Nov 15 '15 at 02:25
  • In the process of rewriting it from scratch to see where I went wrong. Anyone find the error? No? – Louis Jenkins Nov 16 '15 at 04:51

0 Answers0