PIN landscape updates for larger display setting

When using large/larger display settings in landscape, the pin views
get cut off. Tweak the layouts to better fit PIN views. This addresses
a regression from Android 11.

Fixes: 185735801
Test: manual (follow bug steps)
Change-Id: Ice7a08eccb5a0c98a2b73e23c6c156b73ce511b4
diff --git a/packages/SystemUI/res-keyguard/values-land/dimens.xml b/packages/SystemUI/res-keyguard/values-land/dimens.xml
new file mode 100644
index 0000000..6342b9c
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/values-land/dimens.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2021, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources>
+    <dimen name="num_pad_row_margin_bottom">3dp</dimen>
+    <dimen name="keyguard_eca_top_margin">0dp</dimen>
+    <dimen name="keyguard_eca_bottom_margin">2dp</dimen>
+    <dimen name="keyguard_password_height">26dp</dimen>
+    <dimen name="num_pad_entry_row_margin_bottom">0dp</dimen>
+
+    <!-- The size of PIN text in the PIN unlock method. -->
+    <integer name="scaled_password_text_size">26</integer>
+</resources>
diff --git a/packages/SystemUI/res-keyguard/values-sw360dp-land/dimens.xml b/packages/SystemUI/res-keyguard/values-sw360dp-land/dimens.xml
index eb5843b..f465be4 100644
--- a/packages/SystemUI/res-keyguard/values-sw360dp-land/dimens.xml
+++ b/packages/SystemUI/res-keyguard/values-sw360dp-land/dimens.xml
@@ -23,4 +23,7 @@
     <dimen name="keyguard_eca_bottom_margin">4dp</dimen>
     <dimen name="keyguard_password_height">50dp</dimen>
     <dimen name="num_pad_entry_row_margin_bottom">4dp</dimen>
+
+    <!-- The size of PIN text in the PIN unlock method. -->
+    <integer name="scaled_password_text_size">40</integer>
 </resources>
diff --git a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
index b80f8bd..b159714 100644
--- a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
+++ b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
@@ -21,6 +21,7 @@
 import android.animation.AnimatorSet;
 import android.animation.ValueAnimator;
 import android.content.Context;
+import android.content.res.Configuration;
 import android.content.res.TypedArray;
 import android.graphics.Canvas;
 import android.graphics.Color;
@@ -87,7 +88,7 @@
     /**
      * The raw text size, will be multiplied by the scaled density when drawn
      */
-    private final int mTextHeightRaw;
+    private int mTextHeightRaw;
     private final int mGravity;
     private ArrayList<CharState> mTextChars = new ArrayList<>();
     private String mText = "";
@@ -147,6 +148,7 @@
         } finally {
             a.recycle();
         }
+
         mDrawPaint.setFlags(Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
         mDrawPaint.setTextAlign(Paint.Align.CENTER);
         mDrawPaint.setTypeface(Typeface.create(
@@ -164,6 +166,12 @@
     }
 
     @Override
+    protected void onConfigurationChanged(Configuration newConfig) {
+        mTextHeightRaw = getContext().getResources().getInteger(
+                R.integer.scaled_password_text_size);
+    }
+
+    @Override
     protected void onDraw(Canvas canvas) {
         float totalDrawingWidth = getDrawingWidth();
         float currentDrawPosition;