android: show sync progress at notification, prevent app to sleep, temp fix of hanging after closing from recent apps

This commit is contained in:
ardocrat
2023-05-23 01:46:42 +03:00
parent f05d930f60
commit 22c5b945c6
20 changed files with 426 additions and 234 deletions
@@ -1,7 +1,7 @@
package mw.gri.android;
import android.content.Intent;
import android.os.Bundle;
import android.os.Process;
import android.system.ErrnoException;
import android.system.Os;
import com.google.androidgamesdk.GameActivity;
@@ -9,7 +9,7 @@ import com.google.androidgamesdk.GameActivity;
public class MainActivity extends GameActivity {
static {
System.loadLibrary("grim_android");
System.loadLibrary("grim");
}
@Override
@@ -20,9 +20,29 @@ public class MainActivity extends GameActivity {
throw new RuntimeException(e);
}
super.onCreate(savedInstanceState);
BackgroundService.start(getApplicationContext());
}
@Override
protected void onDestroy() {
if (!mManualExit) {
BackgroundService.stop(getApplicationContext());
// Temporary fix to prevent app hanging when closed from recent apps
Process.killProcess(Process.myPid());
}
super.onDestroy();
}
public int[] getDisplayCutouts() {
return Utils.getDisplayCutouts(this);
}
private boolean mManualExit = false;
// Called from native code
public void onExit() {
mManualExit = true;
BackgroundService.stop(getApplicationContext());
finish();
}
}