Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit adc10f2a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "TouchLatency: do not attempt to change resolution"

parents db8c3d05 33098eee
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.os.Bundle;
import android.os.Trace;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Display;
@@ -30,9 +31,9 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.os.Trace;
import android.view.Window;
import android.view.WindowManager;

import java.math.RoundingMode;
import java.text.DecimalFormat;

@@ -280,6 +281,17 @@ public class TouchLatencyActivity extends Activity {
        WindowManager.LayoutParams params = w.getAttributes();

        int modeIndex = (mCurrentModeIndex + 1) % mDisplayModes.length;
        while (modeIndex != mCurrentModeIndex) {
            // skip modes with different resolutions
            Mode currentMode = mDisplayModes[mCurrentModeIndex];
            Mode nextMode = mDisplayModes[modeIndex];
            if (currentMode.getPhysicalHeight() == nextMode.getPhysicalHeight()
                    && currentMode.getPhysicalWidth() == nextMode.getPhysicalWidth()) {
                break;
            }
            modeIndex = (modeIndex + 1) % mDisplayModes.length;
        }

        params.preferredDisplayModeId = mDisplayModes[modeIndex].getModeId();
        w.setAttributes(params);