Merge "[Bouncer] Add button for esim bouncer." into tm-qpr-dev
This commit is contained in:
@@ -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>
|
||||||
@@ -17,15 +17,17 @@
|
|||||||
*/
|
*/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- This contains disable esim buttonas shared by sim_pin/sim_puk screens -->
|
<!-- This contains disable eSim buttons shared by sim_pin/sim_puk screens -->
|
||||||
<com.android.keyguard.KeyguardEsimArea
|
<com.android.keyguard.KeyguardEsimArea xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
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_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/keyguard_disable_esim"
|
android:background="@drawable/kg_bouncer_secondary_button"
|
||||||
android:visibility="gone"
|
android:drawablePadding="10dp"
|
||||||
|
android:drawableStart="@drawable/ic_no_sim"
|
||||||
|
android:drawableTint="?android:attr/textColorPrimary"
|
||||||
android:text="@string/disable_carrier_button_text"
|
android:text="@string/disable_carrier_button_text"
|
||||||
style="@style/Keyguard.TextView"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:textSize="@dimen/kg_status_line_font_size"
|
android:textSize="@dimen/kg_status_line_font_size"
|
||||||
android:textAllCaps="@bool/kg_use_all_caps" />
|
android:visibility="gone" />
|
||||||
|
|||||||
@@ -47,8 +47,7 @@
|
|||||||
<include layout="@layout/keyguard_esim_area"
|
<include layout="@layout/keyguard_esim_area"
|
||||||
android:id="@+id/keyguard_esim_area"
|
android:id="@+id/keyguard_esim_area"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" />
|
||||||
android:layout_marginTop="@dimen/eca_overlap" />
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/row0"
|
android:id="@+id/row0"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -51,8 +51,7 @@
|
|||||||
<include layout="@layout/keyguard_esim_area"
|
<include layout="@layout/keyguard_esim_area"
|
||||||
android:id="@+id/keyguard_esim_area"
|
android:id="@+id/keyguard_esim_area"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" />
|
||||||
android:layout_marginTop="@dimen/eca_overlap" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/row0"
|
android:id="@+id/row0"
|
||||||
|
|||||||
@@ -31,8 +31,4 @@
|
|||||||
<!-- Overload default clock widget parameters -->
|
<!-- Overload default clock widget parameters -->
|
||||||
<dimen name="widget_big_font_size">100dp</dimen>
|
<dimen name="widget_big_font_size">100dp</dimen>
|
||||||
<dimen name="widget_label_font_size">18sp</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>
|
</resources>
|
||||||
|
|||||||
@@ -44,10 +44,6 @@
|
|||||||
<dimen name="keyguard_eca_top_margin">18dp</dimen>
|
<dimen name="keyguard_eca_top_margin">18dp</dimen>
|
||||||
<dimen name="keyguard_eca_bottom_margin">12dp</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 -->
|
<!-- Slice header -->
|
||||||
<dimen name="widget_title_font_size">20dp</dimen>
|
<dimen name="widget_title_font_size">20dp</dimen>
|
||||||
<dimen name="widget_title_line_height">24dp</dimen>
|
<dimen name="widget_title_line_height">24dp</dimen>
|
||||||
|
|||||||
10
packages/SystemUI/res/drawable/ic_no_sim.xml
Normal file
10
packages/SystemUI/res/drawable/ic_no_sim.xml
Normal file
@@ -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>
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,21 +18,14 @@ package com.android.keyguard;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import androidx.core.graphics.drawable.DrawableCompat;
|
|
||||||
|
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a PIN pad for unlocking.
|
* Displays a PIN pad for unlocking.
|
||||||
*/
|
*/
|
||||||
public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
public class KeyguardSimPinView extends KeyguardSimInputView {
|
||||||
private ImageView mSimImageView;
|
|
||||||
public static final String TAG = "KeyguardSimPinView";
|
public static final String TAG = "KeyguardSimPinView";
|
||||||
|
|
||||||
public KeyguardSimPinView(Context context) {
|
public KeyguardSimPinView(Context context) {
|
||||||
@@ -43,12 +36,6 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
super(context, attrs);
|
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
|
@Override
|
||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
@@ -68,7 +55,6 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
mSimImageView = findViewById(R.id.keyguard_sim);
|
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
|
|
||||||
if (mEcaView instanceof EmergencyCarrierArea) {
|
if (mEcaView instanceof EmergencyCarrierArea) {
|
||||||
@@ -86,17 +72,4 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
return getContext().getString(
|
return getContext().getString(
|
||||||
com.android.internal.R.string.keyguard_accessibility_sim_pin_unlock);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class KeyguardSimPinViewController
|
|||||||
showDefaultMessage();
|
showDefaultMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
mView.setEsimLocked(KeyguardEsimArea.isEsimLocked(mView.getContext(), mSubId), mSubId);
|
mView.setESimLocked(KeyguardEsimArea.isEsimLocked(mView.getContext(), mSubId), mSubId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,13 +19,8 @@ package com.android.keyguard;
|
|||||||
import static com.android.systemui.util.PluralMessageFormaterKt.icuMessageFormat;
|
import static com.android.systemui.util.PluralMessageFormaterKt.icuMessageFormat;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import androidx.core.graphics.drawable.DrawableCompat;
|
|
||||||
|
|
||||||
import com.android.systemui.R;
|
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.
|
* Displays a PIN pad for entering a PUK (Pin Unlock Kode) provided by a carrier.
|
||||||
*/
|
*/
|
||||||
public class KeyguardSimPukView extends KeyguardPinBasedInputView {
|
public class KeyguardSimPukView extends KeyguardSimInputView {
|
||||||
private ImageView mSimImageView;
|
|
||||||
private static final boolean DEBUG = KeyguardConstants.DEBUG;
|
private static final boolean DEBUG = KeyguardConstants.DEBUG;
|
||||||
public static final String TAG = "KeyguardSimPukView";
|
public static final String TAG = "KeyguardSimPukView";
|
||||||
|
|
||||||
@@ -86,7 +80,6 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
mSimImageView = findViewById(R.id.keyguard_sim);
|
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
|
|
||||||
if (mEcaView instanceof EmergencyCarrierArea) {
|
if (mEcaView instanceof EmergencyCarrierArea) {
|
||||||
@@ -104,18 +97,4 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
|
|||||||
return getContext().getString(
|
return getContext().getString(
|
||||||
com.android.internal.R.string.keyguard_accessibility_sim_puk_unlock);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import android.telephony.SubscriptionInfo;
|
|||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
@@ -173,11 +172,9 @@ public class KeyguardSimPukViewController
|
|||||||
if (mShowDefaultMessage) {
|
if (mShowDefaultMessage) {
|
||||||
showDefaultMessage();
|
showDefaultMessage();
|
||||||
}
|
}
|
||||||
boolean isEsimLocked = KeyguardEsimArea.isEsimLocked(mView.getContext(), mSubId);
|
|
||||||
|
|
||||||
KeyguardEsimArea esimButton = mView.findViewById(R.id.keyguard_esim_area);
|
mView.setESimLocked(KeyguardEsimArea.isEsimLocked(mView.getContext(), mSubId), mSubId);
|
||||||
esimButton.setSubscriptionId(mSubId);
|
|
||||||
esimButton.setVisibility(isEsimLocked ? View.VISIBLE : View.GONE);
|
|
||||||
mPasswordEntry.requestFocus();
|
mPasswordEntry.requestFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user