Remove the bad orientation hack. Seems the Nexus 5X bug is fixed.

I suppose other devices might also have the bug, but meh... platform bugs :(

Should help #10779
This commit is contained in:
Henrik Rydgård committed 2018-03-25 15:14:15 +02:00
1 parent 74230452da
commit d40ebbf8cb
1 file changed
-14
@@ -530,26 +530,12 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
}
private Point desiredSize = new Point();
private int badOrientationCount = 0;
@Override
public void surfaceCreated(SurfaceHolder holder) {
pixelWidth = holder.getSurfaceFrame().width();
pixelHeight = holder.getSurfaceFrame().height();
// Workaround for terrible bug when locking and unlocking the screen in landscape mode on Nexus 5X.
int requestedOr = getRequestedOrientation();
boolean requestedPortrait = requestedOr == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT || requestedOr == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
boolean detectedPortrait = pixelHeight > pixelWidth;
if (badOrientationCount < 3 && requestedPortrait != detectedPortrait && requestedOr != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
Log.e(TAG, "Bad orientation detected (w=" + pixelWidth + " h=" + pixelHeight + "! Recreating activity.");
badOrientationCount++;
recreate();
return;
} else if (requestedPortrait == detectedPortrait) {
Log.i(TAG, "Correct orientation detected, resetting orientation counter.");
badOrientationCount = 0;
}
Log.d(TAG, "Surface created. pixelWidth=" + pixelWidth + ", pixelHeight=" + pixelHeight + " holder: " + holder.toString() + " or: " + requestedOr);
NativeApp.setDisplayParameters(pixelWidth, pixelHeight, (int)densityDpi, refreshRate);
getDesiredBackbufferSize(desiredSize);