From d86a5160fa31549327cbe9d8869c8135cfd5014d Mon Sep 17 00:00:00 2001 From: Peter Lewis Date: Thu, 19 Nov 2020 14:58:22 -0800 Subject: [PATCH] ANDROID: moved setContentView to after permissions Calling setContentView between permission requests would cause some apps to hang. This problem was previously addressed by adding a shell override function for onRequestPermissionResult, which is no longer needed and is removed in this commit --- loaders/android/bootstrap.java.in | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/loaders/android/bootstrap.java.in b/loaders/android/bootstrap.java.in index 54f734c1..24040ce4 100644 --- a/loaders/android/bootstrap.java.in +++ b/loaders/android/bootstrap.java.in @@ -107,17 +107,6 @@ public class @SYS_APPNAME@ extends Activity implements @ANDROID_JAVA_IMPLEMENTS@ return true; } - @IF_ANDROIDAPI_GT_22@ - @Override - public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - //Must do something with results data or app will hang - int rc = requestCode; - String p = permissions[0]; - int gr = grantResults[0]; - } - /* end of IF_ANDROIDAPI_GT_22 */ - @Override public void startActivityForResult(Intent intent, int cont) { try { @@ -185,12 +174,13 @@ public class @SYS_APPNAME@ extends Activity implements @ANDROID_JAVA_IMPLEMENTS@ nativeInstanceInit(getApplicationContext().getPackageCodePath().toString(), getFilesDir().toString()); mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); - checkOrRequestPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE); - setContentView(mGLView); // MUST NOT run before nativeInstanceInit completed - // Additions needed by modules, e.g. gps + checkOrRequestPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE); + // Additions and permissions needed by modules, e.g. gps @ANDROID_JAVA_ONCREATE@ + setContentView(mGLView); // MUST NOT run before nativeInstanceInit completed + // start EVENT_IDLE if(idle_tmScheduleRate > 0) idle_tm.scheduleAtFixedRate(idle_task, 0, idle_tmScheduleRate); }