About the unlock the lock screen, Yes, I have taken this in count whith using the SetShowWhenLock function you have kindly provided.
About the CallSubDelayed, when the screen is manually set to off, the activity is Paused with Userclosed (False) but is still visible.
And in the "normal operation mode" (when the service is handling the opening/closing of the A2 activity, all is fine : A2 opens, the screen light is on and off without problem.
What I have noticed too, is the A2 - Resume called twice and the state of UserClosed is set to True when s1 handles the closing and False when the screen was set to off manually.
1st
** Activity (main) Resume **
** Service (s1) Create **
** Service (s1) Start **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Pause, UserClosed = false **
** Activity (a2) Create, isFirst = true **
** Activity (a2) Resume **
** Activity (a2) Resume **
** Activity (a2) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Normal open/close operation (screen is not put off by the user
** Activity (a2) Create, isFirst = false **
** Activity (a2) Resume **
** Activity (a2) Resume **
** Activity (a2) Pause, UserClosed = false **
** Activity (a2) Resume **
** Activity (a2) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Operation when the screen was set to off by the user when A2 was shown
** Activity (a2) Create, isFirst = false **
** Activity (a2) Resume **
** Activity (a2) Resume **
** Activity (a2) Pause, UserClosed = false **
So I have tried to put a call to the Hide sub (A2) from Activity_Pause in A2 when UserClosed is False but this won't work.
What I am trying to do is to be sure that A2 will pop-up each time when s1 calls A2. Any idea ?