mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-17 04:39:34 +00:00
Android: Only keep the screen bright ingame.
This commit is contained in:
parent
97546d30ff
commit
a8083b9684
@ -30,6 +30,7 @@
|
||||
#include <condition_variable>
|
||||
|
||||
#include "base/timeutil.h"
|
||||
#include "base/NativeApp.h"
|
||||
#include "math/math_util.h"
|
||||
#include "thread/threadutil.h"
|
||||
#include "util/text/utf8.h"
|
||||
@ -106,6 +107,16 @@ void UpdateUIState(GlobalUIState newState) {
|
||||
if (globalUIState != newState && globalUIState != UISTATE_EXIT) {
|
||||
globalUIState = newState;
|
||||
host->UpdateDisassembly();
|
||||
const char *state = nullptr;
|
||||
switch (globalUIState) {
|
||||
case UISTATE_EXIT: state = "exit"; break;
|
||||
case UISTATE_INGAME: state = "ingame"; break;
|
||||
case UISTATE_MENU: state = "menu"; break;
|
||||
case UISTATE_PAUSEMENU: state = "pausemenu"; break;
|
||||
}
|
||||
if (state) {
|
||||
System_SendMessage("uistate", state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,9 +476,6 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
|
||||
updateScreenRotation("onCreate");
|
||||
updateSustainedPerformanceMode();
|
||||
|
||||
// Keep the screen bright - very annoying if it goes dark when tilting away
|
||||
Window window = this.getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
gainAudioFocus(this.audioManager, this.audioFocusChangeListener);
|
||||
@ -1290,6 +1287,15 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
|
||||
} else if (mCameraHelper != null && params.equals("stopVideo")) {
|
||||
mCameraHelper.stopCamera();
|
||||
}
|
||||
} else if (command.equals("uistate")) {
|
||||
Window window = this.getWindow();
|
||||
if (params.equals("ingame")) {
|
||||
// Keep the screen bright - very annoying if it goes dark when tilting away
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
} else {
|
||||
// Only keep the screen bright ingame.
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user