Skip to content

Commit

Permalink
add SIM PIN/PUK input layout scrambling setting
Browse files Browse the repository at this point in the history
  • Loading branch information
muhomorr committed Aug 12, 2024
1 parent 0ad2312 commit 13aff95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions res/xml/sim_lock_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
android:summaryOn="@string/sim_lock_on"
android:summaryOff="@string/sim_lock_off"/>

<SwitchPreferenceCompat
android:key="sim_scramble_pin_layout"
android:dependency="sim_toggle"
android:title="@string/scramble_pin_title"/>

<com.android.settings.EditPinPreference
android:key="sim_pin"
android:dependency="sim_toggle"
Expand Down
8 changes: 8 additions & 0 deletions src/com/android/settings/IccLockSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.ext.settings.ExtSettings;
import android.graphics.PixelFormat;
import android.os.AsyncTask;
import android.os.Bundle;
Expand Down Expand Up @@ -124,6 +125,7 @@ public class IccLockSettings extends SettingsPreferenceFragment

private EditPinPreference mPinDialog;
private TwoStatePreference mPinToggle;
private TwoStatePreference mPinScramblingToggle;

private Resources mRes;

Expand Down Expand Up @@ -195,6 +197,10 @@ public void onCreate(Bundle savedInstanceState) {

mPinDialog = (EditPinPreference) findPreference(PIN_DIALOG);
mPinToggle = (TwoStatePreference) findPreference(PIN_TOGGLE);
mPinScramblingToggle = (TwoStatePreference) findPreference("sim_scramble_pin_layout");
mPinScramblingToggle.setOnPreferenceChangeListener((preference, newValue) -> {
return ExtSettings.SCRAMBLE_SIM_PIN_LAYOUT.put(requireContext(), (boolean) newValue);
});
if (savedInstanceState != null) {
if (savedInstanceState.containsKey(DIALOG_STATE)
&& restoreDialogStates(savedInstanceState)) {
Expand Down Expand Up @@ -358,6 +364,8 @@ private void updatePreferences() {
mPinToggle.setChecked(isIccLockEnabled());
}
}

mPinScramblingToggle.setChecked(ExtSettings.SCRAMBLE_SIM_PIN_LAYOUT.get(requireContext()));
}

@Override
Expand Down

0 comments on commit 13aff95

Please sign in to comment.