Finish PIA if UnknownSourcesListener would like to start a PIA again

when starting PIA in UnknownSourcesListener, the start flags we used
doesn't work for multiple user case, it will cause the two APIs in
the task. Because the caller may use startActivityForResult, it makes
the PackageInstaller cannot in the seperate task to resolve the
above limitation. To avoid multiple PIAs in the task, PIA will finish
itself if UnknownSourcesListener would like to start a PIA again.

Bug: 202942446
Bug: 286182192
Test: atest CtsPackageInstallTestCases
Test: manual. The issue flow is resolved.
Test: manual. Normal install flow that will trigger unknown source
flow.

Change-Id: Icfce5b79b1cf356015b908f5c3ac44a488707dd7
Merged-In: Icfce5b79b1cf356015b908f5c3ac44a488707dd7
1 file changed