Fix sim pin settings

Change-Id: I8fba2a367958da5831efd04f599ba7a363d11a1f
Fixes: 27419276
Fixes: 27529989
This commit is contained in:
Jason Monk
2016-03-30 11:41:45 -04:00
parent d719ae8e37
commit 5b39710e6d
5 changed files with 18 additions and 8 deletions

View File

@@ -46,8 +46,8 @@
android:layout_width="0dip" android:layout_width="0dip"
android:layout_height="0dip" /> android:layout_height="0dip" />
<ListView <FrameLayout
android:id="@android:id/list" android:id="@+id/main_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dip" android:layout_height="0dip"
android:layout_weight="1" android:layout_weight="1"

View File

@@ -50,7 +50,7 @@ class EditPinPreference extends CustomEditTextPreference {
protected void onBindDialogView(View view) { protected void onBindDialogView(View view) {
super.onBindDialogView(view); super.onBindDialogView(view);
final EditText editText = getEditText(); final EditText editText = (EditText) view.findViewById(android.R.id.edit);
if (editText != null) { if (editText != null) {
editText.setInputType(InputType.TYPE_CLASS_NUMBER | editText.setInputType(InputType.TYPE_CLASS_NUMBER |

View File

@@ -27,7 +27,6 @@ import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.support.v14.preference.SwitchPreference; import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
@@ -40,7 +39,6 @@ import android.widget.TabHost.TabContentFactory;
import android.widget.TabHost.TabSpec; import android.widget.TabHost.TabSpec;
import android.widget.TabWidget; import android.widget.TabWidget;
import android.widget.Toast; import android.widget.Toast;
import com.android.internal.logging.MetricsProto.MetricsEvent; import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.telephony.Phone; import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory; import com.android.internal.telephony.PhoneFactory;
@@ -340,6 +338,7 @@ public class IccLockSettings extends InstrumentedPreferenceActivity
mPinDialog.setDialogMessage(message); mPinDialog.setDialogMessage(message);
} }
@Override
public void onPinEntered(EditPinPreference preference, boolean positiveResult) { public void onPinEntered(EditPinPreference preference, boolean positiveResult) {
if (!positiveResult) { if (!positiveResult) {
resetDialogState(); resetDialogState();
@@ -384,7 +383,8 @@ public class IccLockSettings extends InstrumentedPreferenceActivity
} }
} }
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { @Override
public boolean onPreferenceTreeClick(Preference preference) {
if (preference == mPinToggle) { if (preference == mPinToggle) {
// Get the new, preferred state // Get the new, preferred state
mToState = mPinToggle.isChecked(); mToState = mPinToggle.isChecked();

View File

@@ -28,6 +28,9 @@ public abstract class InstrumentedFragment extends PreferenceFragment {
// Declare new temporary categories here, starting after this value. // Declare new temporary categories here, starting after this value.
public static final int UNDECLARED = 100000; public static final int UNDECLARED = 100000;
// Used by PreferenceActivity for the dummy fragment it adds, no useful data here.
public static final int PREFERENCE_ACTIVITY_FRAGMENT = UNDECLARED + 1;
/** /**
* Declare the view of this category. * Declare the view of this category.
* *

View File

@@ -17,7 +17,6 @@ package com.android.settings;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.os.Bundle; import android.os.Bundle;
import android.support.v14.preference.PreferenceFragment;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen; import android.support.v7.preference.PreferenceScreen;
@@ -57,7 +56,7 @@ public class PreferenceActivity extends SettingsActivity {
|| PreferenceActivityFragment.class.getName().equals(fragmentName); || PreferenceActivityFragment.class.getName().equals(fragmentName);
} }
public static class PreferenceActivityFragment extends PreferenceFragment { public static class PreferenceActivityFragment extends SettingsPreferenceFragment {
@Override @Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
((PreferenceActivity) getActivity()).mFragment = this; ((PreferenceActivity) getActivity()).mFragment = this;
@@ -70,6 +69,14 @@ public class PreferenceActivity extends SettingsActivity {
} }
return super.onPreferenceTreeClick(preference); return super.onPreferenceTreeClick(preference);
} }
@Override
protected int getMetricsCategory() {
if (getActivity() instanceof InstrumentedPreferenceActivity) {
return ((InstrumentedPreferenceActivity) getActivity()).getMetricsCategory();
}
return InstrumentedFragment.PREFERENCE_ACTIVITY_FRAGMENT;
}
} }
} }