Ignore PIP mode request for destroyed activity

PIP request can be postponed if keyguard is on.
If the activity is destroyed before keyguard is dismissed,
Then PIP operation causes NullPointerException.

In such case we should ignore PIP mode request.

Test:
Manual test -
 1.Configure Keyguard (Pattern, Password) for secure lock
 2.Receive a WhatsApp video call
 3.Press Back Key (WhatsApp enters into PIP mode)
 4.Caller ends a video call
 5.When user (receiver) unlocks the screen, system reboots
Test: atest WmTests:ActivityTaskManagerServiceTests#testEnterPipModeWhenRecordParentChangesToNull

Bug: 144045134

Change-Id: I8f67e57b2bfaa187829622b050c6ce387d749e8d
(cherry-picked from ae2c5e52efbd59b6bccd5b677b4047a292fe86fc)
2 files changed