Use of Relinker to avoid all the UnsatisfiedLinkError piling up
This commit is contained in:
parent
db69cb7613
commit
5b87aff021
5 changed files with 61 additions and 31 deletions
|
@ -6,7 +6,7 @@ model {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.ab.x48"
|
applicationId "org.ab.x48"
|
||||||
minSdkVersion.apiLevel 8
|
minSdkVersion.apiLevel 9
|
||||||
targetSdkVersion.apiLevel 24
|
targetSdkVersion.apiLevel 24
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,4 +22,7 @@ model {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
compile 'com.getkeepsafe.relinker:relinker:1.2.2'
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.ab.x48" android:installLocation="auto" android:versionCode="67" android:versionName="1.67">
|
package="org.ab.x48" android:installLocation="auto" android:versionCode="69" android:versionName="1.69">
|
||||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||||
<activity android:name=".X48"
|
<activity android:name=".X48"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|
|
@ -118,7 +118,6 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
||||||
audiobuf = new short [44100]; // 1s worth
|
audiobuf = new short [44100]; // 1s worth
|
||||||
track = new AudioTrack(AudioManager.STREAM_MUSIC, 44100, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, 16384, AudioTrack.MODE_STREAM);
|
track = new AudioTrack(AudioManager.STREAM_MUSIC, 44100, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, 16384, AudioTrack.MODE_STREAM);
|
||||||
annImages = new Bitmap [6];
|
annImages = new Bitmap [6];
|
||||||
updateContrast();
|
|
||||||
matrixScreen = new Matrix();
|
matrixScreen = new Matrix();
|
||||||
matrixBack= new Matrix();
|
matrixBack= new Matrix();
|
||||||
annImages [0] = BitmapFactory.decodeResource(x48.getResources(), R.drawable.ann01);
|
annImages [0] = BitmapFactory.decodeResource(x48.getResources(), R.drawable.ann01);
|
||||||
|
|
|
@ -16,6 +16,9 @@ import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.os.Message;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -23,6 +26,8 @@ import android.view.MenuItem;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
|
|
||||||
|
import com.getkeepsafe.relinker.ReLinker;
|
||||||
|
|
||||||
public class X48 extends Activity {
|
public class X48 extends Activity {
|
||||||
|
|
||||||
private HPView mainView;
|
private HPView mainView;
|
||||||
|
@ -38,26 +43,57 @@ public class X48 extends Activity {
|
||||||
|
|
||||||
private static EmulatorThread thread;
|
private static EmulatorThread thread;
|
||||||
private static Timer SIGALRM;
|
private static Timer SIGALRM;
|
||||||
|
private Handler mHandler;
|
||||||
|
|
||||||
private static boolean errorLib;
|
|
||||||
|
|
||||||
// http://www.hpcalc.org/hp48/pc/emulators/gxrom-r.zip
|
// http://www.hpcalc.org/hp48/pc/emulators/gxrom-r.zip
|
||||||
|
|
||||||
|
private ReLinker.Logger logcatLogger = new ReLinker.Logger() {
|
||||||
|
@Override
|
||||||
|
public void log(String message) {
|
||||||
|
Log.d("ReLinker", message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
if (errorLib) {
|
|
||||||
showDialog(DIALOG_LIB_KO);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//Log.i("x48", "starting activity");
|
//Log.i("x48", "starting activity");
|
||||||
boolean firstLaunch = !AssetUtil.copyAsset(this, getResources().getAssets(), false);
|
boolean firstLaunch = !AssetUtil.copyAsset(this, getResources().getAssets(), false);
|
||||||
|
|
||||||
readyToGo() ;
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
if (!AssetUtil.isFilesReady(this)) {
|
requestWindowFeature(Window.FEATURE_PROGRESS);
|
||||||
showDialog(DIALOG_ROM_KO);
|
setContentView(R.layout.main);
|
||||||
return;
|
mainView = (HPView) findViewById(R.id.hpview);
|
||||||
}
|
|
||||||
|
mHandler = new Handler(Looper.getMainLooper()) {
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message inputMessage) {
|
||||||
|
if (inputMessage.what == 1) {
|
||||||
|
readyToGo();
|
||||||
|
if (!AssetUtil.isFilesReady(X48.this)) {
|
||||||
|
showDialog(DIALOG_ROM_KO);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showDialog(DIALOG_LIB_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ReLinker.recursively().log(logcatLogger).loadLibrary(X48.this, "droid48", new ReLinker.LoadListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void success() {
|
||||||
|
mHandler.obtainMessage(1).sendToTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failure(Throwable t) {
|
||||||
|
mHandler.obtainMessage(0).sendToTarget();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://stackoverflow.com/questions/9996333/openoptionsmenu-function-not-working-in-ics
|
// http://stackoverflow.com/questions/9996333/openoptionsmenu-function-not-working-in-ics
|
||||||
|
@ -81,19 +117,16 @@ public class X48 extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readyToGo() {
|
public void readyToGo() {
|
||||||
hp48s = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("hp48s", false);
|
hp48s = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("hp48s", false);
|
||||||
|
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
checkPrefs();
|
||||||
requestWindowFeature(Window.FEATURE_PROGRESS);
|
|
||||||
setContentView(R.layout.main);
|
|
||||||
mainView = (HPView) findViewById(R.id.hpview);
|
|
||||||
|
|
||||||
checkPrefs();
|
|
||||||
|
|
||||||
thread = new EmulatorThread(this);
|
thread = new EmulatorThread(this);
|
||||||
thread.start();
|
thread.start();
|
||||||
mainView.resume();
|
mainView.resume();
|
||||||
}
|
mainView.updateContrast();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,13 +205,6 @@ public class X48 extends Activity {
|
||||||
mainView.emulatorReady();
|
mainView.emulatorReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
System.loadLibrary("droid48");
|
|
||||||
} catch (java.lang.UnsatisfiedLinkError e) {
|
|
||||||
errorLib = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -191,7 +217,8 @@ public class X48 extends Activity {
|
||||||
SIGALRM.schedule(new TimerTask() {
|
SIGALRM.schedule(new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
SIGALRM();
|
if (thread != null)
|
||||||
|
SIGALRM();
|
||||||
}
|
}
|
||||||
}, 0, 20);
|
}, 0, 20);
|
||||||
if (mainView != null)
|
if (mainView != null)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url "https://jitpack.io" }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle-experimental:0.8.3'
|
classpath 'com.android.tools.build:gradle-experimental:0.8.3'
|
||||||
|
|
Loading…
Reference in a new issue