1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.keyguard;
18 
19 import android.content.Context;
20 import android.content.res.Configuration;
21 import android.util.AttributeSet;
22 import android.view.View;
23 
24 import com.android.systemui.R;
25 
26 /**
27  * Displays a PIN pad for unlocking.
28  */
29 public class KeyguardSimPinView extends KeyguardPinBasedInputView {
30     public static final String TAG = "KeyguardSimPinView";
31 
KeyguardSimPinView(Context context)32     public KeyguardSimPinView(Context context) {
33         this(context, null);
34     }
35 
KeyguardSimPinView(Context context, AttributeSet attrs)36     public KeyguardSimPinView(Context context, AttributeSet attrs) {
37         super(context, attrs);
38     }
39 
setEsimLocked(boolean locked)40     public void setEsimLocked(boolean locked) {
41         KeyguardEsimArea esimButton = findViewById(R.id.keyguard_esim_area);
42         esimButton.setVisibility(locked ? View.VISIBLE : View.GONE);
43     }
44 
45     @Override
onConfigurationChanged(Configuration newConfig)46     protected void onConfigurationChanged(Configuration newConfig) {
47         super.onConfigurationChanged(newConfig);
48         resetState();
49     }
50 
51     @Override
getPromptReasonStringRes(int reason)52     protected int getPromptReasonStringRes(int reason) {
53         // No message on SIM Pin
54         return 0;
55     }
56 
57     @Override
getPasswordTextViewId()58     protected int getPasswordTextViewId() {
59         return R.id.simPinEntry;
60     }
61 
62     @Override
onFinishInflate()63     protected void onFinishInflate() {
64         super.onFinishInflate();
65 
66         if (mEcaView instanceof EmergencyCarrierArea) {
67             ((EmergencyCarrierArea) mEcaView).setCarrierTextVisible(true);
68         }
69     }
70 
71     @Override
startAppearAnimation()72     public void startAppearAnimation() {
73         // noop.
74     }
75 
76     @Override
getTitle()77     public CharSequence getTitle() {
78         return getContext().getString(
79                 com.android.internal.R.string.keyguard_accessibility_sim_pin_unlock);
80     }
81 }
82 
83