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

Commit b6d847fd authored by Mark Harman's avatar Mark Harman
Browse files

Fixes for edge-to-edge mode, including when navigation bar is along landscape edge.

parent 6169abed
Loading
Loading
Loading
Loading
+51 −7
Original line number Diff line number Diff line
@@ -913,7 +913,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
        Point display_size = new Point();
        {
            mActivity.getApplicationInterface().getDisplaySize(display_size);
            mActivity.getApplicationInterface().getDisplaySize(display_size, false);
            Log.d(TAG, "display_size: " + display_size.x + " x " + display_size.y);
        }
        //double targetRatio = mPreview.getTargetRatioForPreview(display_size);
@@ -958,7 +958,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
        Point display_size = new Point();
        {
            mActivity.getApplicationInterface().getDisplaySize(display_size);
            mActivity.getApplicationInterface().getDisplaySize(display_size, false);
            Log.d(TAG, "display_size: " + display_size.x + " x " + display_size.y);
        }
        CameraController.Size picture_size = mPreview.getCameraController().getPictureSize();
@@ -4858,6 +4858,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
    /** Tests the use of the FLAG_LAYOUT_NO_LIMITS flag introduced in 1.48.
     *  In 1.49 this was replaced with View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION.
     *  In 1.54 this was replaced with WindowCompat.setDecorFitsSystemWindows().
     *  In 1.54, on Android 15+ we now support always running in edge-to-edge mode (MainActivity.edge_to_edge_mode).
     */
    public void testLayoutNoLimits() throws InterruptedException {
        Log.d(TAG, "testLayoutNoLimits");
@@ -4880,10 +4881,30 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
        assertEquals(0, mActivity.getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
        assertFalse(mActivity.test_set_show_under_navigation);
        assertEquals(0, mActivity.getWindow().getDecorView().getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
        assertEquals(mActivity.getNavigationGap(), mActivity.getMainUI().test_navigation_gap);
        assertEquals(mActivity.getNavigationGapLandscape(), mActivity.getMainUI().test_navigation_gap_landscape);
        assertEquals(mActivity.getNavigationGapReverseLandscape(), mActivity.getMainUI().test_navigation_gap_reversed_landscape);
        int initial_navigation_gap = mActivity.getMainUI().test_navigation_gap;
        if( !edge_to_edge_mode ) {
            assertEquals(0, mActivity.getMainUI().test_navigation_gap);
        }
        int initial_navigation_gap_landscape = mActivity.getMainUI().test_navigation_gap_landscape;
        int initial_navigation_gap_reversed_landscape = mActivity.getMainUI().test_navigation_gap_reversed_landscape;
        if( edge_to_edge_mode ) {
            // exactly one navigation gap should be non-zero
            int count = 0;
            if( initial_navigation_gap > 0 )
                count++;
            if( initial_navigation_gap_landscape > 0 )
                count++;
            if( initial_navigation_gap_reversed_landscape > 0 )
                count++;
            assertEquals(1, count);
        }
        else {
            assertEquals(0, initial_navigation_gap_landscape);
            assertEquals(0, initial_navigation_gap_reversed_landscape);
        }
        // test changing resolution
        MainActivity.test_preview_want_no_limits_value = true;
@@ -4905,10 +4926,14 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
            assertTrue(mActivity.test_set_show_under_navigation);
        }
        assertEquals(supports_hide_navigation ? View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : 0, mActivity.getWindow().getDecorView().getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
        assertEquals(mActivity.getNavigationGap(), mActivity.getMainUI().test_navigation_gap);
        assertEquals(mActivity.getNavigationGapLandscape(), mActivity.getMainUI().test_navigation_gap_landscape);
        assertEquals(mActivity.getNavigationGapReverseLandscape(), mActivity.getMainUI().test_navigation_gap_reversed_landscape);
        if( edge_to_edge_mode ) {
            assertEquals(initial_navigation_gap, mActivity.getMainUI().test_navigation_gap);
        }
        assertEquals(mActivity.getNavigationGap(), mActivity.getMainUI().test_navigation_gap);
        assertEquals(initial_navigation_gap_landscape, mActivity.getMainUI().test_navigation_gap_landscape);
        assertEquals(initial_navigation_gap_reversed_landscape, mActivity.getMainUI().test_navigation_gap_reversed_landscape);
        MainActivity.test_preview_want_no_limits_value = false;
        updateForSettings();
        Thread.sleep(1000);
@@ -4921,6 +4946,8 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
        else {
            assertEquals(0, mActivity.getMainUI().test_navigation_gap);
        }
        assertEquals(initial_navigation_gap_landscape, mActivity.getMainUI().test_navigation_gap_landscape);
        assertEquals(initial_navigation_gap_reversed_landscape, mActivity.getMainUI().test_navigation_gap_reversed_landscape);
        if( mPreview.getCameraControllerManager().getNumberOfCameras() > 1 ) {
            // test switching camera
@@ -4935,10 +4962,14 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
                assertTrue(mActivity.test_set_show_under_navigation);
            }
            assertEquals(supports_hide_navigation ? View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : 0, mActivity.getWindow().getDecorView().getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
            assertEquals(mActivity.getNavigationGap(), mActivity.getMainUI().test_navigation_gap);
            assertEquals(mActivity.getNavigationGapLandscape(), mActivity.getMainUI().test_navigation_gap_landscape);
            assertEquals(mActivity.getNavigationGapReverseLandscape(), mActivity.getMainUI().test_navigation_gap_reversed_landscape);
            if( edge_to_edge_mode ) {
                assertEquals(initial_navigation_gap, mActivity.getMainUI().test_navigation_gap);
            }
            assertEquals(mActivity.getNavigationGap(), mActivity.getMainUI().test_navigation_gap);
            assertEquals(initial_navigation_gap_landscape, mActivity.getMainUI().test_navigation_gap_landscape);
            assertEquals(initial_navigation_gap_reversed_landscape, mActivity.getMainUI().test_navigation_gap_reversed_landscape);
            MainActivity.test_preview_want_no_limits_value = false;
            switchToCamera(0);
            Thread.sleep(1000);
@@ -4951,6 +4982,8 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
            else {
                assertEquals(0, mActivity.getMainUI().test_navigation_gap);
            }
            assertEquals(initial_navigation_gap_landscape, mActivity.getMainUI().test_navigation_gap_landscape);
            assertEquals(initial_navigation_gap_reversed_landscape, mActivity.getMainUI().test_navigation_gap_reversed_landscape);
        }
        // test switching to video and back
@@ -4968,10 +5001,14 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
            assertTrue(mActivity.test_set_show_under_navigation);
        }
        assertEquals(supports_hide_navigation ? View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : 0, mActivity.getWindow().getDecorView().getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
        assertEquals(mActivity.getNavigationGap(), mActivity.getMainUI().test_navigation_gap);
        assertEquals(mActivity.getNavigationGapLandscape(), mActivity.getMainUI().test_navigation_gap_landscape);
        assertEquals(mActivity.getNavigationGapReverseLandscape(), mActivity.getMainUI().test_navigation_gap_reversed_landscape);
        if( edge_to_edge_mode ) {
            assertEquals(initial_navigation_gap, mActivity.getMainUI().test_navigation_gap);
        }
        assertEquals(mActivity.getNavigationGap(), mActivity.getMainUI().test_navigation_gap);
        assertEquals(initial_navigation_gap_landscape, mActivity.getMainUI().test_navigation_gap_landscape);
        assertEquals(initial_navigation_gap_reversed_landscape, mActivity.getMainUI().test_navigation_gap_reversed_landscape);
        MainActivity.test_preview_want_no_limits_value = false;
        clickView(switchVideoButton);
        waitUntilCameraOpened();
@@ -4986,6 +5023,8 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
        else {
            assertEquals(0, mActivity.getMainUI().test_navigation_gap);
        }
        assertEquals(initial_navigation_gap_landscape, mActivity.getMainUI().test_navigation_gap_landscape);
        assertEquals(initial_navigation_gap_reversed_landscape, mActivity.getMainUI().test_navigation_gap_reversed_landscape);
        // test after restart
        MainActivity.test_preview_want_no_limits_value = true;
@@ -4999,10 +5038,14 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
            assertTrue(mActivity.test_set_show_under_navigation);
        }
        assertEquals(supports_hide_navigation ? View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : 0, mActivity.getWindow().getDecorView().getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
        assertEquals(mActivity.getNavigationGap(), mActivity.getMainUI().test_navigation_gap);
        assertEquals(mActivity.getNavigationGapLandscape(), mActivity.getMainUI().test_navigation_gap_landscape);
        assertEquals(mActivity.getNavigationGapReverseLandscape(), mActivity.getMainUI().test_navigation_gap_reversed_landscape);
        if( edge_to_edge_mode ) {
            assertEquals(initial_navigation_gap, mActivity.getMainUI().test_navigation_gap);
        }
        assertEquals(mActivity.getNavigationGap(), mActivity.getMainUI().test_navigation_gap);
        assertEquals(initial_navigation_gap_landscape, mActivity.getMainUI().test_navigation_gap_landscape);
        assertEquals(initial_navigation_gap_reversed_landscape, mActivity.getMainUI().test_navigation_gap_reversed_landscape);
    }
    /** Tests the use of the FLAG_LAYOUT_NO_LIMITS flag introduced in 1.48, with the mode set from startup.
@@ -8207,7 +8250,8 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
        Point display_size = new Point();
        {
            mActivity.getApplicationInterface().getDisplaySize(display_size);
            // call with exclude_insets==true, as in this test we're measuring things about the UI
            mActivity.getApplicationInterface().getDisplaySize(display_size, true);
            Log.d(TAG, "display_size: " + display_size.x + " x " + display_size.y);
        }
        View settingsButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.settings);
+56 −15
Original line number Diff line number Diff line
@@ -164,6 +164,8 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
    private boolean want_no_limits; // whether we want to run with FLAG_LAYOUT_NO_LIMITS
    private boolean set_window_insets_listener; // whether we've enabled a setOnApplyWindowInsetsListener()
    private int navigation_gap; // gap for navigation bar along bottom (portrait) or right (landscape)
    private int navigation_gap_landscape; // gap for navigation bar along left (portrait) or bottom (landscape); only set for edge_to_edge_mode==true
    private int navigation_gap_reverse_landscape; // gap for navigation bar along right (portrait) or top (landscape); only set for edge_to_edge_mode==true
    public static volatile boolean test_preview_want_no_limits; // test flag, if set to true then instead use test_preview_want_no_limits_value; needs to be static, as it needs to be set before activity is created to take effect
    public static volatile boolean test_preview_want_no_limits_value;
    public volatile boolean test_set_show_under_navigation; // test flag, the value of enable for the last call of showUnderNavigation() (or false if not yet called)
@@ -514,7 +516,7 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen

                if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && isInMultiWindowMode() ) {
                    Point display_size = new Point();
                    applicationInterface.getDisplaySize(display_size);
                    applicationInterface.getDisplaySize(display_size, true);
                    if( MyDebug.LOG ) {
                        Log.d(TAG, "    display width: " + display_size.x);
                        Log.d(TAG, "    display height: " + display_size.y);
@@ -3753,6 +3755,14 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        return (want_no_limits || edge_to_edge_mode) ? navigation_gap : 0;
    }

    public int getNavigationGapLandscape() {
        return edge_to_edge_mode ? navigation_gap_landscape : 0;
    }

    public int getNavigationGapReverseLandscape() {
        return edge_to_edge_mode ? navigation_gap_reverse_landscape : 0;
    }

    /** The system is now such that we have entered or exited immersive mode. If visible is true,
     *  system UI is now visible such that we should exit immersive mode. If visible is false, the
     *  system has entered immersive mode.
@@ -3803,27 +3813,32 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
                    if( MyDebug.LOG )
                        Log.d(TAG, "onApplyWindowInsets");
                    int inset_left;
                    //int inset_top;
                    int inset_top;
                    int inset_right;
                    int inset_bottom;
                    if( edge_to_edge_mode && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R ) {
                        // take opportunity to use non-deprecated versions; also for edge_to_edge_mode==true, we need to use getInsetsIgnoringVisibility for
                        // immersive mode (since for edge_to_edge_mode==true, we are not using setSystemUiVisibility() / SYSTEM_UI_FLAG_LAYOUT_STABLE in setImmersiveMode())
                        Insets insets = windowInsets.getInsetsIgnoringVisibility(WindowInsets.Type.systemBars());
                        inset_left = insets.left;
                        //inset_top = insets.top;
                        inset_right = insets.right;
                        inset_bottom = insets.bottom;
                        // also compare with MyApplicationInterface.getDisplaySize() - in particular we don't care about caption/system bar that is returned on e.g.
                        // OnePlus Pad for insets.top when in landscape orientation (since the system bar isn't shown); however we also need to subtract any from the cutout -
                        // since this code is for finding what margins we need to set to avoid navigation bars; avoiding the cutout is done below for the entire
                        // Open Camera view
                        Insets insets = windowInsets.getInsetsIgnoringVisibility(WindowInsets.Type.navigationBars() | WindowInsets.Type.displayCutout());
                        Insets cutout_insets = windowInsets.getInsetsIgnoringVisibility(WindowInsets.Type.displayCutout());
                        inset_left = insets.left - cutout_insets.left;
                        inset_top = insets.top - cutout_insets.top;
                        inset_right = insets.right - cutout_insets.right;
                        inset_bottom = insets.bottom - cutout_insets.bottom;
                    }
                    else {
                        inset_left = windowInsets.getSystemWindowInsetLeft();
                        //inset_top = windowInsets.getSystemWindowInsetTop();
                        inset_top = windowInsets.getSystemWindowInsetTop();
                        inset_right = windowInsets.getSystemWindowInsetRight();
                        inset_bottom = windowInsets.getSystemWindowInsetBottom();
                    }
                    if( MyDebug.LOG ) {
                        Log.d(TAG, "inset left: " + inset_left);
                        //Log.d(TAG, "inset top: " + inset_top);
                        Log.d(TAG, "inset top: " + inset_top);
                        Log.d(TAG, "inset right: " + inset_right);
                        Log.d(TAG, "inset bottom: " + inset_bottom);
                    }
@@ -3838,35 +3853,57 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
                        immersiveModeChanged( windowInsets.isVisible(WindowInsets.Type.navigationBars()) );
                    }

                    resetCachedSystemOrientation(); // don't want to get cached result - this can sometimes happen e.g. on Pixel 6 Pro when switching between landscape and reverse landscape
                    SystemOrientation system_orientation = getSystemOrientation();
                    int new_navigation_gap;
                    int new_navigation_gap, new_navigation_gap_landscape, new_navigation_gap_reverse_landscape;
                    switch ( system_orientation ) {
                        case PORTRAIT:
                            if( MyDebug.LOG )
                                Log.d(TAG, "portrait");
                            new_navigation_gap = inset_bottom;
                            new_navigation_gap_landscape = inset_left;
                            new_navigation_gap_reverse_landscape = inset_right;
                            break;
                        case LANDSCAPE:
                            if( MyDebug.LOG )
                                Log.d(TAG, "landscape");
                            new_navigation_gap = inset_right;
                            new_navigation_gap_landscape = inset_bottom;
                            new_navigation_gap_reverse_landscape = inset_top;
                            break;
                        case REVERSE_LANDSCAPE:
                            if( MyDebug.LOG )
                                Log.d(TAG, "reverse landscape");
                            new_navigation_gap = inset_left;
                            new_navigation_gap_landscape = inset_top;
                            new_navigation_gap_reverse_landscape = inset_bottom;
                            break;
                        default:
                            Log.e(TAG, "unknown system_orientation?!: " + system_orientation);
                            new_navigation_gap = 0;
                            new_navigation_gap_landscape = 0;
                            new_navigation_gap_reverse_landscape = 0;
                            break;
                    }
                    if( !edge_to_edge_mode ) {
                        // we only care about avoiding a landscape navigation bar (e.g., large tablets in landscape orientation) for edge_to_edge_mode==true
                        // in theory this could be useful when edge_to_edge_mode==false, but in practice we will never enter edge-to-edge-mode if the
                        // navigation bar is along the landscape-edge, so restrict behaviour change to edge_to_edge_mode==true
                        new_navigation_gap_landscape = 0;
                        new_navigation_gap_reverse_landscape = 0;
                    }

                    if( has_last_system_orientation && system_orientation != last_system_orientation && new_navigation_gap != navigation_gap ) {
                    // for edge_to_edge_mode==false, we only enter this case if system orientation changes, due to issues where this callback may be called first with 0 navigation gap
                    // (see notes below)
                    // for edge_to_edge_mode==true, simpler to always react to updated insets - in particular, in split-window mode, the navigation gaps can
                    // change when device rotates, even though the application remains in the same orientation
                    if( (edge_to_edge_mode || (has_last_system_orientation && system_orientation != last_system_orientation)) && (new_navigation_gap != navigation_gap || new_navigation_gap_landscape != navigation_gap_landscape || new_navigation_gap_reverse_landscape != navigation_gap_reverse_landscape ) ) {
                        if( MyDebug.LOG )
                            Log.d(TAG, "navigation_gap changed due to system orientation change, from " + navigation_gap + " to " + new_navigation_gap);
                            Log.d(TAG, "navigation_gap changed from " + navigation_gap + " to " + new_navigation_gap);

                        navigation_gap = new_navigation_gap;
                        navigation_gap_landscape = new_navigation_gap_landscape;
                        navigation_gap_reverse_landscape = new_navigation_gap_reverse_landscape;

                        if( MyDebug.LOG )
                            Log.d(TAG, "want_no_limits: " + want_no_limits);
@@ -3898,6 +3935,10 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
                                            Log.d(TAG, "clear FLAG_LAYOUT_NO_LIMITS");
                                        showUnderNavigation(false);
                                    }
                                    // needed for OnePlus Pad when rotating, to avoid delay in updating last_take_photo_top_time (affects placement of on-screen text e.g. zoom)
                                    // need to do this from handler for this to take effect (otherwise last_take_photo_top_time won't update to new value)
                                    applicationInterface.getDrawPreview().onNavigationGapChanged();

                                    if( MyDebug.LOG )
                                        Log.d(TAG, "layout UI due to changing navigation_gap");
                                    mainUI.layoutUI();
@@ -3905,7 +3946,7 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
                            });
                        }
                    }
                    else if( navigation_gap == 0 ) {
                    else if( !edge_to_edge_mode && navigation_gap == 0 ) {
                        if( MyDebug.LOG )
                            Log.d(TAG, "navigation_gap changed from zero to " + new_navigation_gap);
                        navigation_gap = new_navigation_gap;
@@ -4412,7 +4453,7 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
            int bitmap_width = options.outWidth;
            int bitmap_height = options.outHeight;
            Point display_size = new Point();
            applicationInterface.getDisplaySize(display_size);
            applicationInterface.getDisplaySize(display_size, true);
            if( MyDebug.LOG ) {
                Log.d(TAG, "bitmap_width: " + bitmap_width);
                Log.d(TAG, "bitmap_height: " + bitmap_height);
@@ -5619,7 +5660,7 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        }
        else if( set_window_insets_listener && !edge_to_edge_mode ) {
            Point display_size = new Point();
            applicationInterface.getDisplaySize(display_size);
            applicationInterface.getDisplaySize(display_size, true);
            int display_width = Math.max(display_size.x, display_size.y);
            int display_height = Math.min(display_size.x, display_size.y);
            double display_aspect_ratio = ((double)display_width)/(double)display_height;
+14 −8
Original line number Diff line number Diff line
@@ -1917,18 +1917,24 @@ public class MyApplicationInterface extends BasicApplicationInterface {
    }

    @Override
    public void getDisplaySize(Point display_size) {
    public void getDisplaySize(Point display_size, boolean exclude_insets) {
        if( Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R ) {
            // use non-deprecated equivalent of Display.getSize()
            WindowMetrics window_metrics = main_activity.getWindowManager().getCurrentWindowMetrics();
            final Rect bounds = window_metrics.getBounds();
            if( !main_activity.getEdgeToEdgeMode() || exclude_insets ) {
                // use non-deprecated equivalent of Display.getSize()
                final WindowInsets windowInsets = window_metrics.getWindowInsets();
                Insets insets = windowInsets.getInsetsIgnoringVisibility(WindowInsets.Type.navigationBars() | WindowInsets.Type.displayCutout());
                int insetsWidth = insets.right + insets.left;
                int insetsHeight = insets.top + insets.bottom;
            final Rect bounds = window_metrics.getBounds();
                display_size.x = bounds.width() - insetsWidth;
                display_size.y = bounds.height() - insetsHeight;
            }
            else {
                display_size.x = bounds.width();
                display_size.y = bounds.height();
            }
        }
        else {
            Display display = main_activity.getWindowManager().getDefaultDisplay();
            display.getSize(display_size);
+7 −1
Original line number Diff line number Diff line
@@ -193,7 +193,13 @@ public interface ApplicationInterface {
    boolean allowZoom(); // if false, don't allow zoom functionality even if the device supports it - Preview.supportsZoom() will also return false; if true, allow zoom if the device supports it
    boolean optimiseFocusForLatency(); // behaviour for taking photos with continuous focus mode: if true, optimise focus for latency (take photo asap); if false, optimise for quality (don't take photo until scene is focused)

    void getDisplaySize(Point display_size); // get size of default display, e.g., Activity.getWindowManager().getDefaultDisplay().getSize()
    /** Return size of default display, e.g., Activity.getWindowManager().getDefaultDisplay().getSize().
     * @param display_size The returned display size.
     * @param exclude_insets If the activity is running in edge-to-edge mode, then whether to exclude
     *                       insets. If the activity is not running in edge-to-edge mode, then this should
     *                       be ignored, and insets should always be excluded.
     */
    void getDisplaySize(Point display_size, boolean exclude_insets);

    // for testing purposes:
    boolean isTestAlwaysFocus(); // if true, pretend autofocus always successful
+1 −1
Original line number Diff line number Diff line
@@ -3949,7 +3949,7 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu
        double minDiff = Double.MAX_VALUE;
        Point display_size = new Point();
        {
            applicationInterface.getDisplaySize(display_size);
            applicationInterface.getDisplaySize(display_size, false); // don't exclude insets, as preview runs under insets in edge-to-edge mode
            // getSize() is adjusted based on the current rotation, so should already be landscape format, but:
            // (a) it would be good to not assume Open Camera runs in landscape mode (if we ever ran in portrait mode,
            // we'd still want display_size.x > display_size.y as preview resolutions also have width > height,
Loading