mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Merge pull request #6894 from libretro/android_susperf
android: enable sustained performance mode if supported
This commit is contained in:
commit
48128a9b36
@ -10,7 +10,7 @@
|
|||||||
<uses-feature android:name="android.hardware.gamepad" android:required="false"/>
|
<uses-feature android:name="android.hardware.gamepad" android:required="false"/>
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="9"
|
android:minSdkVersion="9"
|
||||||
android:targetSdkVersion="23" />
|
android:targetSdkVersion="24" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
@ -11,5 +11,5 @@
|
|||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-23
|
target=android-24
|
||||||
android.library.reference.1=libs/googleplay
|
android.library.reference.1=libs/googleplay
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
package com.retroarch.browser.retroactivity;
|
package com.retroarch.browser.retroactivity;
|
||||||
|
|
||||||
import com.retroarch.browser.preferences.util.UserPreferences;
|
import com.retroarch.browser.preferences.util.UserPreferences;
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.app.UiModeManager;
|
import android.app.UiModeManager;
|
||||||
import android.os.BatteryManager;
|
import android.os.BatteryManager;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.PowerManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,6 +31,31 @@ public class RetroActivityCommon extends RetroActivityLocation
|
|||||||
finish();
|
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()
|
public int getBatteryLevel()
|
||||||
{
|
{
|
||||||
IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
|
IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
|
||||||
|
@ -4,9 +4,10 @@ import android.view.View;
|
|||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.hardware.input.InputManager;
|
||||||
|
import android.os.Build;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import android.hardware.input.InputManager;
|
|
||||||
|
|
||||||
public final class RetroActivityFuture extends RetroActivityCamera {
|
public final class RetroActivityFuture extends RetroActivityCamera {
|
||||||
|
|
||||||
@ -17,7 +18,12 @@ public final class RetroActivityFuture extends RetroActivityCamera {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.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
|
// Immersive mode
|
||||||
|
|
||||||
// Constants from API > 14
|
// Constants from API > 14
|
||||||
|
Loading…
x
Reference in New Issue
Block a user