[Base] Android error reporting via SIGABRT/RuntimeException

This commit is contained in:
Triang3l 2022-01-30 18:36:11 +03:00
parent c5e3332640
commit d2ef8d3300
5 changed files with 71 additions and 7 deletions

View file

@ -0,0 +1,21 @@
package jp.xenia;
/**
* Base class for all unchecked exceptions thrown by the Xenia project components.
*/
public class XeniaRuntimeException extends RuntimeException {
public XeniaRuntimeException() {
}
public XeniaRuntimeException(String name) {
super(name);
}
public XeniaRuntimeException(String name, Throwable cause) {
super(name, cause);
}
public XeniaRuntimeException(Exception cause) {
super(cause);
}
}

View file

@ -3,11 +3,10 @@ package jp.xenia.emulator;
import android.app.Activity;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.util.Log;
import jp.xenia.XeniaRuntimeException;
public abstract class WindowedAppActivity extends Activity {
private static final String TAG = "WindowedAppActivity";
static {
// TODO(Triang3l): Move all demos to libxenia.so.
System.loadLibrary("xenia-ui-window-vulkan-demo");
@ -26,11 +25,12 @@ public abstract class WindowedAppActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAppContext = initializeWindowedAppOnCreateNative(getWindowedAppIdentifier(), getAssets());
final String windowedAppIdentifier = getWindowedAppIdentifier();
mAppContext = initializeWindowedAppOnCreateNative(windowedAppIdentifier, getAssets());
if (mAppContext == 0) {
Log.e(TAG, "Error initializing the windowed app");
finish();
return;
throw new XeniaRuntimeException(
"Error initializing the windowed app " + windowedAppIdentifier);
}
}