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
diff --git a/.gitignore b/.gitignore
index 33bfd97..ff66172 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,6 @@
 *.iml
 *.class
 *.sw*
+
+# Jars added by Idea's "Konfigure kotlin in project" action
+**/lib/kotlin-*.jar
\ No newline at end of file