diff options
12 files changed, 124 insertions, 76 deletions
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 000000000000..732fc57dbded --- /dev/null +++ b/packages/SystemUI/res-keyguard/drawable/kg_bouncer_secondary_button.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> + +<inset xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" + android:insetTop="6dp" + android:insetBottom="6dp"> + <ripple android:color="?android:attr/colorControlHighlight"> + <item android:id="@android:id/mask"> + <shape android:shape="rectangle"> + <solid android:color="?android:attr/textColorSecondary"/> + <corners android:radius="24dp"/> + </shape> + </item> + <item> + <shape android:shape="rectangle"> + <corners android:radius="24dp"/> + <solid android:color="@android:color/transparent"/> + <stroke android:color="?androidprv:attr/colorAccentTertiary" + android:width="1dp" + /> + <padding android:left="16dp" + android:top="12dp" + android:right="16dp" + android:bottom="12dp"/> + </shape> + </item> + </ripple> +</inset> diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_esim_area.xml b/packages/SystemUI/res-keyguard/layout/keyguard_esim_area.xml index db508c91e0de..67fd5b9a78bd 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 @@ */ --> -<!-- This contains disable esim buttonas shared by sim_pin/sim_puk screens --> -<com.android.keyguard.KeyguardEsimArea - xmlns:android="http://schemas.android.com/apk/res/android" +<!-- This contains disable eSim buttons shared by sim_pin/sim_puk screens --> +<com.android.keyguard.KeyguardEsimArea xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/keyguard_disable_esim" + style="@style/Keyguard.TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:id="@+id/keyguard_disable_esim" - android:visibility="gone" + android:background="@drawable/kg_bouncer_secondary_button" + android:drawablePadding="10dp" + android:drawableStart="@drawable/ic_no_sim" + android:drawableTint="?android:attr/textColorPrimary" android:text="@string/disable_carrier_button_text" - style="@style/Keyguard.TextView" - android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/kg_status_line_font_size" - android:textAllCaps="@bool/kg_use_all_caps" /> + 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 f2fe520f340f..7db0fe908ec0 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 @@ <include layout="@layout/keyguard_esim_area" android:id="@+id/keyguard_esim_area" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/eca_overlap" /> + android:layout_height="wrap_content" /> <RelativeLayout android:id="@+id/row0" android:layout_width="match_parent" diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml index a21ec29267fe..422bd4c12e8e 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml @@ -51,8 +51,7 @@ <include layout="@layout/keyguard_esim_area" android:id="@+id/keyguard_esim_area" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/eca_overlap" /> + android:layout_height="wrap_content" /> <RelativeLayout android:id="@+id/row0" diff --git a/packages/SystemUI/res-keyguard/values-sw600dp/dimens.xml b/packages/SystemUI/res-keyguard/values-sw600dp/dimens.xml index e80cfafdd71a..a1068c65bae2 100644 --- a/packages/SystemUI/res-keyguard/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res-keyguard/values-sw600dp/dimens.xml @@ -31,8 +31,4 @@ <!-- Overload default clock widget parameters --> <dimen name="widget_big_font_size">100dp</dimen> <dimen name="widget_label_font_size">18sp</dimen> - - <!-- EmergencyCarrierArea overlap - amount to overlap the emergency button and carrier text. - Should be 0 on devices with plenty of room (e.g. tablets) --> - <dimen name="eca_overlap">0dip</dimen> </resources> diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml index ac131ae1c99f..46f6ab2399d1 100644 --- a/packages/SystemUI/res-keyguard/values/dimens.xml +++ b/packages/SystemUI/res-keyguard/values/dimens.xml @@ -44,10 +44,6 @@ <dimen name="keyguard_eca_top_margin">18dp</dimen> <dimen name="keyguard_eca_bottom_margin">12dp</dimen> - <!-- EmergencyCarrierArea overlap - amount to overlap the emergency button and carrier text. - Should be 0 on devices with plenty of room (e.g. tablets) --> - <dimen name="eca_overlap">-10dip</dimen> - <!-- Slice header --> <dimen name="widget_title_font_size">20dp</dimen> <dimen name="widget_title_line_height">24dp</dimen> 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 000000000000..ccfb6ea642cc --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_no_sim.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="?attr/colorControlNormal"> + <path + android:fillColor="@android:color/white" + android:pathData="M20,17.175 L18,15.175V4Q18,4 18,4Q18,4 18,4H10.85L8.85,6L7.4,4.6L10,2H18Q18.825,2 19.413,2.587Q20,3.175 20,4ZM20.5,23.3 L6,8.8V20Q6,20 6,20Q6,20 6,20H18Q18,20 18,20Q18,20 18,20V17.975L20,19.975V20Q20,20.825 19.413,21.413Q18.825,22 18,22H6Q5.175,22 4.588,21.413Q4,20.825 4,20V8L4.6,7.4L0.7,3.5L2.125,2.1L21.9,21.875ZM13.525,10.675Q13.525,10.675 13.525,10.675Q13.525,10.675 13.525,10.675ZM11.65,14.475Q11.65,14.475 11.65,14.475Q11.65,14.475 11.65,14.475Q11.65,14.475 11.65,14.475Q11.65,14.475 11.65,14.475Z"/> +</vector> 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 000000000000..b4bfca1185f4 --- /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 ae9d3dfec3b2..9d170150a709 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 2a2e9bf54bb2..91bf20f90690 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 c0971bf8c16d..5f45fe31a779 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 203f9b660536..d8cffd7984ba 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(); } } |