Fix Wi-Fi QR code scanner height at 360dp

To avoid error message cut on small screen devices

Bug: 131628795
Test: manual
Change-Id: I33fa55da22823064608739bed33cdd287bffa0b8
diff --git a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
index 68ba277..33a942c 100644
--- a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
+++ b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
@@ -43,21 +43,18 @@
                 android:layout_marginBottom="8dp"
                 style="?android:attr/progressBarStyleHorizontal"/>
 
-            <androidx.constraintlayout.widget.ConstraintLayout
-                xmlns:app="http://schemas.android.com/apk/res-auto"
+            <FrameLayout
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content">
                 <TextureView
                     android:id="@+id/preview_view"
                     android:layout_width="match_parent"
-                    android:layout_height="0dp"
-                    app:layout_constraintDimensionRatio="1:1"/>
+                    android:layout_height="@dimen/qrcode_preview_size"/>
                 <com.android.settings.wifi.qrcode.QrDecorateView
                     android:id="@+id/decorate_view"
                     android:layout_width="match_parent"
-                    android:layout_height="0dp"
-                    app:layout_constraintDimensionRatio="1:1"/>
-            </androidx.constraintlayout.widget.ConstraintLayout>
+                    android:layout_height="@dimen/qrcode_preview_size"/>
+            </FrameLayout>
 
             <TextView
                 android:id="@+id/error_message"
diff --git a/src/com/android/settings/wifi/qrcode/QrCamera.java b/src/com/android/settings/wifi/qrcode/QrCamera.java
index b7d41ba..6088fa5 100644
--- a/src/com/android/settings/wifi/qrcode/QrCamera.java
+++ b/src/com/android/settings/wifi/qrcode/QrCamera.java
@@ -313,9 +313,6 @@
     private void setTransformationMatrix(Size viewSize) {
         // Check aspect ratio, can only handle square view.
         final int viewRatio = (int)getRatio(viewSize.getWidth(), viewSize.getHeight());
-        if (viewRatio != 1) {
-            throw new IllegalArgumentException("Preview area should be square");
-        }
 
         final boolean isPortrait = mContext.get().getResources().getConfiguration().orientation
                 == Configuration.ORIENTATION_PORTRAIT ? true : false;