Fix PermissionsHostTest and make activity result capturing more robust

The Activity instance that gets onActivityResult/onPermissionResult in not
always the same as the one that called startActivityForResult/requestPermission.

This was both a cause of some flakes and a recent breakage.

Bug: 128423549
Test: atest android.appsecurity.cts.PermissionsHostTest
Change-Id: Ic85f646020ee61023667d29875e065493e638bc2
15 files changed