Add retry mechanism in assertLockTaskModeInactive

Can't reproduce the issue, but guess the reason is the "lock task mode"
state in AMS is updated asynchronously.
In ActivityStackSupervisor.removeLockedTaskLocked, a message is en-queued
to the handler, which eventually setting
mLockTaskModeState = LOCK_TASK_MODE_NONE. So it is possibly that the
task is just not executed yet.

Fix: 36179399
Test: cts-tradefed run cts  --skip-connectivity-check --skip-preconditions --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testLockTask_deviceOwnerUser
Change-Id: I15b2e133e7476a8b82c11ddcb8f0f3ff42973e0e
1 file changed