diff --git a/packages/SystemUI/res-keyguard/drawable/kg_bouncer_secondary_button.xml b/packages/SystemUI/res-keyguard/drawable/kg_bouncer_secondary_button.xml
new file mode 100644
index 0000000000000..732fc57dbdedf
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/drawable/kg_bouncer_secondary_button.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_esim_area.xml b/packages/SystemUI/res-keyguard/layout/keyguard_esim_area.xml
index db508c91e0de2..67fd5b9a78bd4 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_esim_area.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_esim_area.xml
@@ -17,15 +17,17 @@
*/
-->
-
-
+
+ android:visibility="gone" />
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
index f2fe520f340f6..7db0fe908ec05 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
@@ -47,8 +47,7 @@
+ android:layout_height="wrap_content" />
+ android:layout_height="wrap_content" />
100dp
18sp
-
-
- 0dip
diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml
index ac131ae1c99fd..46f6ab2399d1d 100644
--- a/packages/SystemUI/res-keyguard/values/dimens.xml
+++ b/packages/SystemUI/res-keyguard/values/dimens.xml
@@ -44,10 +44,6 @@
18dp
12dp
-
- -10dip
-
20dp
24dp
diff --git a/packages/SystemUI/res/drawable/ic_no_sim.xml b/packages/SystemUI/res/drawable/ic_no_sim.xml
new file mode 100644
index 0000000000000..ccfb6ea642ccc
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_no_sim.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimInputView.kt b/packages/SystemUI/src/com/android/keyguard/KeyguardSimInputView.kt
new file mode 100644
index 0000000000000..b4bfca1185f40
--- /dev/null
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimInputView.kt
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+package com.android.keyguard
+
+import android.content.Context
+import android.util.AttributeSet
+import android.widget.ImageView
+import androidx.core.graphics.drawable.DrawableCompat
+import com.android.systemui.R
+
+abstract class KeyguardSimInputView(context: Context, attrs: AttributeSet) :
+ KeyguardPinBasedInputView(context, attrs) {
+ private var simImageView: ImageView? = null
+ private var disableESimButton: KeyguardEsimArea? = null
+
+ override fun onFinishInflate() {
+ simImageView = findViewById(R.id.keyguard_sim)
+ disableESimButton = findViewById(R.id.keyguard_esim_area)
+ super.onFinishInflate()
+ }
+
+ /** Set UI state based on whether there is a locked eSim card */
+ fun setESimLocked(isESimLocked: Boolean, subId: Int) {
+ disableESimButton?.setSubscriptionId(subId)
+ disableESimButton?.visibility = if (isESimLocked) VISIBLE else GONE
+ simImageView?.visibility = if (isESimLocked) GONE else VISIBLE
+ }
+
+ override fun reloadColors() {
+ super.reloadColors()
+ val customAttrs = intArrayOf(android.R.attr.textColorSecondary)
+ val a = context.obtainStyledAttributes(customAttrs)
+ val imageColor = a.getColor(0, 0)
+ a.recycle()
+ simImageView?.let {
+ val wrappedDrawable = DrawableCompat.wrap(it.drawable)
+ DrawableCompat.setTint(wrappedDrawable, imageColor)
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
index ae9d3dfec3b2a..9d170150a7093 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
@@ -18,21 +18,14 @@ package com.android.keyguard;
import android.content.Context;
import android.content.res.Configuration;
-import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
-import android.view.View;
-import android.widget.ImageView;
-
-import androidx.core.graphics.drawable.DrawableCompat;
import com.android.systemui.R;
/**
* Displays a PIN pad for unlocking.
*/
-public class KeyguardSimPinView extends KeyguardPinBasedInputView {
- private ImageView mSimImageView;
+public class KeyguardSimPinView extends KeyguardSimInputView {
public static final String TAG = "KeyguardSimPinView";
public KeyguardSimPinView(Context context) {
@@ -43,12 +36,6 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
super(context, attrs);
}
- public void setEsimLocked(boolean locked, int subscriptionId) {
- KeyguardEsimArea esimButton = findViewById(R.id.keyguard_esim_area);
- esimButton.setSubscriptionId(subscriptionId);
- esimButton.setVisibility(locked ? View.VISIBLE : View.GONE);
- }
-
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
@@ -68,7 +55,6 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
@Override
protected void onFinishInflate() {
- mSimImageView = findViewById(R.id.keyguard_sim);
super.onFinishInflate();
if (mEcaView instanceof EmergencyCarrierArea) {
@@ -86,17 +72,4 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
return getContext().getString(
com.android.internal.R.string.keyguard_accessibility_sim_pin_unlock);
}
-
- @Override
- public void reloadColors() {
- super.reloadColors();
-
- int[] customAttrs = {android.R.attr.textColorSecondary};
- TypedArray a = getContext().obtainStyledAttributes(customAttrs);
- int imageColor = a.getColor(0, 0);
- a.recycle();
- Drawable wrappedDrawable = DrawableCompat.wrap(mSimImageView.getDrawable());
- DrawableCompat.setTint(wrappedDrawable, imageColor);
- }
}
-
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java
index ecd88e6fe90c7..76f7d785071d2 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java
@@ -105,7 +105,7 @@ public class KeyguardSimPinViewController
showDefaultMessage();
}
- mView.setEsimLocked(KeyguardEsimArea.isEsimLocked(mView.getContext(), mSubId), mSubId);
+ mView.setESimLocked(KeyguardEsimArea.isEsimLocked(mView.getContext(), mSubId), mSubId);
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
index c0971bf8c16de..5f45fe31a779b 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
@@ -19,13 +19,8 @@ package com.android.keyguard;
import static com.android.systemui.util.PluralMessageFormaterKt.icuMessageFormat;
import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
-import android.widget.ImageView;
-
-import androidx.core.graphics.drawable.DrawableCompat;
import com.android.systemui.R;
@@ -33,8 +28,7 @@ import com.android.systemui.R;
/**
* Displays a PIN pad for entering a PUK (Pin Unlock Kode) provided by a carrier.
*/
-public class KeyguardSimPukView extends KeyguardPinBasedInputView {
- private ImageView mSimImageView;
+public class KeyguardSimPukView extends KeyguardSimInputView {
private static final boolean DEBUG = KeyguardConstants.DEBUG;
public static final String TAG = "KeyguardSimPukView";
@@ -86,7 +80,6 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
@Override
protected void onFinishInflate() {
- mSimImageView = findViewById(R.id.keyguard_sim);
super.onFinishInflate();
if (mEcaView instanceof EmergencyCarrierArea) {
@@ -104,18 +97,4 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
return getContext().getString(
com.android.internal.R.string.keyguard_accessibility_sim_puk_unlock);
}
-
- @Override
- public void reloadColors() {
- super.reloadColors();
-
- int[] customAttrs = {android.R.attr.textColorSecondary};
- TypedArray a = getContext().obtainStyledAttributes(customAttrs);
- int imageColor = a.getColor(0, 0);
- a.recycle();
- Drawable wrappedDrawable = DrawableCompat.wrap(mSimImageView.getDrawable());
- DrawableCompat.setTint(wrappedDrawable, imageColor);
- }
}
-
-
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukViewController.java
index 203f9b660536e..d8cffd7984ba1 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukViewController.java
@@ -30,7 +30,6 @@ import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
-import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
@@ -173,11 +172,9 @@ public class KeyguardSimPukViewController
if (mShowDefaultMessage) {
showDefaultMessage();
}
- boolean isEsimLocked = KeyguardEsimArea.isEsimLocked(mView.getContext(), mSubId);
- KeyguardEsimArea esimButton = mView.findViewById(R.id.keyguard_esim_area);
- esimButton.setSubscriptionId(mSubId);
- esimButton.setVisibility(isEsimLocked ? View.VISIBLE : View.GONE);
+ mView.setESimLocked(KeyguardEsimArea.isEsimLocked(mView.getContext(), mSubId), mSubId);
+
mPasswordEntry.requestFocus();
}
}