Remove all activities that do not successfully launch.

We previously were only removing activities that launched with
a fatal result code. Activities that do not start due to a
non-fatal error should also be removed.

Change-Id: I0b38eaaab7e38ed314c6022705170def38e10436
Fixes: 38021882
Test: cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testLockTask_deviceOwnerUser
This commit is contained in:
Bryce Lee
2017-05-17 16:45:36 -07:00
parent ba21a120c1
commit a3b0e3f0d8

View File

@@ -956,7 +956,7 @@ class ActivityStarter {
// If we are not able to proceed, disassociate the activity from the task. Leaving an
// activity in an incomplete state can lead to issues, such as performing operations
// without a window container.
if (ActivityManager.isStartResultFatalError(result)
if (!ActivityManager.isStartResultSuccessful(result)
&& mStartActivity.getTask() != null) {
mStartActivity.getTask().removeActivity(mStartActivity);
}