During the call process, other apps that are running in the background on the phone are getting foreground notify events, so they're popping up. It doesn't happen every time and it doesn't happen at the same point in the call, but it happens regularly.
For example, WhatsApp, when left in the background, will suddenly be in the foreground after the call starts. You can still hear the call, but you're looking at WhatsApp. I've been able to make it happen with LINE as well. Hitting the back hardware button returns you to MyApp.
Here is a trace showing some debug on this issue and explained below (comments prefixed with: <<<<<<<<<<)
According to the Java/J2me/Asha documentation:
Reiterating from the documentation, for this function to return the value TRUE, the Midlet (MyApp application) must be the foreground app, screen in question is set to be the current viewable screen, and its not obscured by anything. In the first portion of the log, you will notice that the MyApp Application remained the foreground application for the entire 30 seconds of testing (event 14:57:32.596).
public boolean isShown()
Checks if the Displayable is actually visible on the display. In order for a Displayable to be visible, all of the following must be true: the Display's MIDlet must be running in the foreground, theDisplayable must be the Display's current screen, and the Displayable must not be obscured by asystem screen.
true if the Displayable is currently visible
I then placed a second call, but with much different results.
- At event 14:57:54.54 we show the second call being disconnected.
- At event 14:57:54.138 we see the same dialer view object being reset to the current view (DialerView@15a8dbe).
- Again the thread shows initially this view is not active, but within one second, the view is now visible on the screen (event 14:57:55.215), and it remains in this state until sometime after event 14:57:58.490.
- All of a sudden, WhatsApp is now the active foreground app on the screen. You can tell this by event 14:57:59.526 – the isShown() function is now indicating that the MyApp Dialer View object is no longer visible on the screen (i.e. the function is returning false, instead of true). You will also notice that no other code of the MyApp Application is executing except the background thread testing to see if the Dialer view is still visible. We can verify this because no other events were logged by the MyApp application.
Something in the Asha system seems to be determining that another application needs to be pushed into the foreground. Any suggestions on how to avoid this?