android: bring back activity to the foreground when exiting PiP

When exiting PiP with by pressing the X the onPictureInPictureModeChanged method
is called. Since onResume is called a while after, in case the maximize button
is called, it's not easy to know if the user pressed the X button, and that was
the cause for exiting PiP.

So, in order to avoid show the user they are still in the meeting, bring the
activity to the foregound so they can hangup.
This commit is contained in:
Saúl Ibarra Corretgé 2020-08-10 13:23:18 +02:00 committed by Saúl Ibarra Corretgé
parent 5b10d8f5ef
commit d9250aa986
1 changed files with 12 additions and 0 deletions

View File

@ -210,6 +210,18 @@ public class MainActivity extends JitsiMeetActivity {
return super.onKeyUp(keyCode, event);
}
@Override
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
super.onPictureInPictureModeChanged(isInPictureInPictureMode);
Log.d(TAG, "Is in picture-in-picture mode: " + isInPictureInPictureMode);
if (!isInPictureInPictureMode) {
this.startActivity(new Intent(this, getClass())
.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));
}
}
// Helper methods
//