From a4850c1b57f5e8a437609b0afec1705a00600901 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 18 Jul 2013 13:27:30 +0200 Subject: [PATCH] (Android) Don't use JELLY_BEAN_MR1 constant as it wasn't available on prior Android versions - use int keycode instead - also implemented stub onTrimMemory/onLowMemory inside NativeActivity wrapper class --- android/phoenix/AndroidManifest.xml | 5 +++-- .../phoenix/src/org/retroarch/browser/RetroActivity.java | 5 ++++- android/phoenix/src/org/retroarch/browser/RetroArch.java | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/android/phoenix/AndroidManifest.xml b/android/phoenix/AndroidManifest.xml index 56eebaad22..f6bf73dad8 100644 --- a/android/phoenix/AndroidManifest.xml +++ b/android/phoenix/AndroidManifest.xml @@ -13,7 +13,8 @@ + android:label="@string/app_name" + android:hasCode="true"> @@ -35,7 +36,7 @@ - + diff --git a/android/phoenix/src/org/retroarch/browser/RetroActivity.java b/android/phoenix/src/org/retroarch/browser/RetroActivity.java index dd0e75a31d..177b438459 100644 --- a/android/phoenix/src/org/retroarch/browser/RetroActivity.java +++ b/android/phoenix/src/org/retroarch/browser/RetroActivity.java @@ -2,7 +2,6 @@ package org.retroarch.browser; import android.app.NativeActivity; import android.os.Bundle; -import android.widget.Toast; public class RetroActivity extends NativeActivity { @@ -21,4 +20,8 @@ public class RetroActivity extends NativeActivity public void onLowMemory() { } + + @Override + public void onTrimMemory(int level) { + } } diff --git a/android/phoenix/src/org/retroarch/browser/RetroArch.java b/android/phoenix/src/org/retroarch/browser/RetroArch.java index 1373a33eff..955a3bf8bc 100644 --- a/android/phoenix/src/org/retroarch/browser/RetroArch.java +++ b/android/phoenix/src/org/retroarch/browser/RetroArch.java @@ -22,6 +22,8 @@ import android.view.ContextMenu.ContextMenuInfo; import android.view.inputmethod.*; import android.graphics.drawable.*; +// JELLY_BEAN_MR1 = 17 + class ModuleWrapper implements IconAdapterItem { public final File file; private ConfigFile config; @@ -352,7 +354,7 @@ public class RetroArch extends Activity implements return "/mnt/sd/retroarch.cfg"; } - @TargetApi(android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) + @TargetApi(17) private int getLowLatencyOptimalSamplingRate() { AudioManager manager = (AudioManager)getApplicationContext().getSystemService(Context.AUDIO_SERVICE); return Integer.parseInt(manager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE)); @@ -360,7 +362,7 @@ public class RetroArch extends Activity implements private int getOptimalSamplingRate() { int ret; - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) + if (android.os.Build.VERSION.SDK_INT >= 17) ret = getLowLatencyOptimalSamplingRate(); else ret = AudioTrack.getNativeOutputSampleRate(AudioManager.STREAM_MUSIC);