mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-06-25 09:29:28 +00:00
Only expose symbols bundled in APK on demand
- Cuts down on launch time - Cuts down on wasted app space
This commit is contained in:
parent
9f5bbe6eb0
commit
42a2fac420
|
@ -146,14 +146,9 @@ public class Apple2Activity extends Activity {
|
|||
// run first-time initializations
|
||||
if (!Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this)) {
|
||||
Apple2DisksMenu.firstTime(this);
|
||||
Apple2DisksMenu.exposeSymbols(this);
|
||||
Apple2Preferences.KeypadPreset.IJKM_SPACE.apply(this);
|
||||
}
|
||||
Apple2Preferences.FIRST_TIME_CONFIGURED.saveBoolean(this, true);
|
||||
if (BuildConfig.DEBUG) {
|
||||
// always copy new symbols while developing/iterating
|
||||
Apple2DisksMenu.exposeSymbols(this);
|
||||
}
|
||||
|
||||
// get device audio parameters for native OpenSLES
|
||||
int sampleRate = DevicePropertyCalculator.getRecommendedSampleRate(this);
|
||||
|
|
|
@ -187,6 +187,8 @@ public class Apple2CrashHandler {
|
|||
@Override
|
||||
public void run() {
|
||||
|
||||
Apple2DisksMenu.exposeSymbols(activity);
|
||||
|
||||
final int sampleRate = DevicePropertyCalculator.getRecommendedSampleRate(activity);
|
||||
final int monoBufferSize = DevicePropertyCalculator.getRecommendedBufferSize(activity, /*isStereo:*/false);
|
||||
final int stereoBufferSize = DevicePropertyCalculator.getRecommendedBufferSize(activity, /*isStereo:*/true);
|
||||
|
@ -239,6 +241,8 @@ public class Apple2CrashHandler {
|
|||
allCrashData.append(">>>>>>> JAVA CRASH DATA\n");
|
||||
allCrashData.append(javaCrashData);
|
||||
|
||||
Apple2DisksMenu.unexposeSymbols(activity);
|
||||
|
||||
// send report with all the data
|
||||
_sendEmailToDeveloperWithCrashData(activity, allCrashData);
|
||||
}
|
||||
|
|
|
@ -137,6 +137,10 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
|||
recursivelyCopyAPKAssets(activity, /*from APK directory:*/"symbols", /*to location:*/new File(sDataDir, "symbols").getAbsolutePath());
|
||||
}
|
||||
|
||||
public static void unexposeSymbols(Apple2Activity activity) {
|
||||
recursivelyDelete(new File(sDataDir, "symbols"));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Apple2MenuView interface methods
|
||||
|
||||
|
@ -274,6 +278,17 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
|||
return pathBuffer.toString();
|
||||
}
|
||||
|
||||
private static void recursivelyDelete(File file) {
|
||||
if (file.isDirectory()) {
|
||||
for (File f : file.listFiles()) {
|
||||
recursivelyDelete(f);
|
||||
}
|
||||
}
|
||||
if (!file.delete()) {
|
||||
Log.d(TAG, "Failed to delete file: " + file);
|
||||
}
|
||||
}
|
||||
|
||||
private static void recursivelyCopyAPKAssets(Apple2Activity activity, String srcFileOrDir, String dstFileOrDir) {
|
||||
AssetManager assetManager = activity.getAssets();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user