diff --git a/pkg/android/phoenix/AndroidManifest.xml b/pkg/android/phoenix/AndroidManifest.xml index ba922a497f..703a158568 100644 --- a/pkg/android/phoenix/AndroidManifest.xml +++ b/pkg/android/phoenix/AndroidManifest.xml @@ -10,7 +10,7 @@ + android:targetSdkVersion="24" /> diff --git a/pkg/android/phoenix/project.properties b/pkg/android/phoenix/project.properties index 319851bab0..93ee842b0e 100644 --- a/pkg/android/phoenix/project.properties +++ b/pkg/android/phoenix/project.properties @@ -11,5 +11,5 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-23 +target=android-24 android.library.reference.1=libs/googleplay diff --git a/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityCommon.java b/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityCommon.java index 5136ba6e08..afea1dee18 100644 --- a/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityCommon.java +++ b/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityCommon.java @@ -1,11 +1,15 @@ package com.retroarch.browser.retroactivity; import com.retroarch.browser.preferences.util.UserPreferences; +import android.annotation.TargetApi; import android.content.res.Configuration; +import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.app.UiModeManager; import android.os.BatteryManager; +import android.os.Build; +import android.os.PowerManager; import android.util.Log; /** @@ -27,6 +31,31 @@ public class RetroActivityCommon extends RetroActivityLocation finish(); } + @TargetApi(24) + public void setSustainedPerformanceMode(boolean on) + { + Log.i("RetroActivity", "setting sustained performance mode to " + on); + getWindow().setSustainedPerformanceMode(on); + } + + public boolean isSustainedPerformanceModeSupported() + { + boolean supported = false; + + if (Build.VERSION.SDK_INT >= 24) + { + PowerManager powerManager = (PowerManager)getSystemService(Context.POWER_SERVICE); + + if (powerManager.isSustainedPerformanceModeSupported()) + supported = true; + } + + + Log.i("RetroActivity", "isSustainedPerformanceModeSupported? " + supported); + + return supported; + } + public int getBatteryLevel() { IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); diff --git a/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java b/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java index dede1ed0b8..558ebcd30c 100644 --- a/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java +++ b/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java @@ -4,9 +4,10 @@ import android.view.View; import android.view.WindowManager; import android.content.Intent; import android.content.Context; +import android.hardware.input.InputManager; +import android.os.Build; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import android.hardware.input.InputManager; public final class RetroActivityFuture extends RetroActivityCamera { @@ -17,7 +18,12 @@ public final class RetroActivityFuture extends RetroActivityCamera { public void onResume() { super.onResume(); - if (android.os.Build.VERSION.SDK_INT >= 19) { + if (Build.VERSION.SDK_INT >= 24) { + if (isSustainedPerformanceModeSupported()) + setSustainedPerformanceMode(true); + } + + if (Build.VERSION.SDK_INT >= 19) { // Immersive mode // Constants from API > 14