Skip to content
Permalink
Browse files

Merge pull request #12033 from rlac/android_screensize_fixes

Android: Display measurement fixes
  • Loading branch information...
hrydgard committed May 13, 2019
2 parents 974d8f5 + c01186d commit 02ff1fa1e9a0b2dc11f8a7ba45f39d6c05eef04d
Showing with 14 additions and 2 deletions.
  1. +14 −2 android/src/org/ppsspp/ppsspp/NativeActivity.java
@@ -457,7 +457,12 @@ public void updateDisplayMeasurements() {

DisplayMetrics metrics = new DisplayMetrics();
if (useImmersive() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
display.getRealMetrics(metrics);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N || !isInMultiWindowMode()) {
display.getRealMetrics(metrics);
} else {
// multi-window mode
display.getMetrics(metrics);
}
} else {
display.getMetrics(metrics);
}
@@ -568,7 +573,6 @@ public void surfaceCreated(SurfaceHolder holder) {
}

Log.d(TAG, "Surface created. pixelWidth=" + pixelWidth + ", pixelHeight=" + pixelHeight + " holder: " + holder.toString() + " or: " + requestedOr);
NativeApp.setDisplayParameters(pixelWidth, pixelHeight, (int) densityDpi, refreshRate);
getDesiredBackbufferSize(desiredSize);

// Note that desiredSize might be 0,0 here - but that's fine when calling setFixedSize! It means auto.
@@ -788,6 +792,14 @@ public void onConfigurationChanged(Configuration newConfig) {
}
}

@Override
public void onMultiWindowModeChanged(boolean isInMultiWindowMode, Configuration newConfig) {
// onConfigurationChanged not called on multi-window change
Log.i(TAG, "onMultiWindowModeChanged: isInMultiWindowMode = " + isInMultiWindowMode);
super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig);
updateDisplayMeasurements();
}

// keep this static so we can call this even if we don't
// instantiate NativeAudioPlayer
public static void gainAudioFocus(AudioManager audioManager, AudioFocusChangeListener focusChangeListener) {

0 comments on commit 02ff1fa

Please sign in to comment.
You can’t perform that action at this time.