app: make GoNativeActivity.getKey static

The input queue runs concurrent with the native activity lifecycle,
and so the getKey helper Java method might be called after the
app has been destroyed. This is particularly likely for "back"
key presses that destroys activities.

Change the getKey method to be static so that it can be called
outside the app lifecycle.

Run `go generate ./cmd/gomobile` to update the compiled dex file that
contains GoNativeActivity.

Fixes golang/go#27652

Change-Id: Id2c863ee07e5447f033e67d6948fbfe746916ffa
Reviewed-on: https://go-review.googlesource.com/135215
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
Elias Naur
2018-09-13 17:01:46 +00:00
parent 6c7f9eaa5c
commit 6d4b718bf3
4 changed files with 36 additions and 23 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ public class GoNativeActivity extends NativeActivity {
return getCacheDir().getAbsolutePath();
}
int getRune(int deviceId, int keyCode, int metaState) {
static int getRune(int deviceId, int keyCode, int metaState) {
try {
int rune = KeyCharacterMap.load(deviceId).get(keyCode, metaState);
if (rune == 0) {