Bug 1255461 - Use PrefsHelper to set master password; r=margaret
authorJim Chen <nchen@mozilla.com>
Fri, 18 Mar 2016 15:18:51 -0400
changeset 289394 071a81d2a723bf55d20ceefa853e816eb31bd088
parent 289393 88427e76ab5697bbc61defd016e9b3e7502cf87b
child 289395 aa409880028ad90ee004dd062a2a865b1fb50c3b
push id30102
push userryanvm@gmail.com
push dateSat, 19 Mar 2016 15:23:17 +0000
treeherdermozilla-central@720fb3d55e28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1255461
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1255461 - Use PrefsHelper to set master password; r=margaret
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -1380,29 +1380,19 @@ OnSharedPreferenceChangeListener
                 final EditText input1 = inputLayout1.getEditText();
                 final EditText input2 = inputLayout2.getEditText();
 
                 builder.setTitle(R.string.masterpassword_create_title)
                        .setView((View) linearLayout)
                        .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
                             @Override
                             public void onClick(DialogInterface dialog, int which) {
-                                JSONObject jsonPref = new JSONObject();
-                                try {
-                                    jsonPref.put("name", PREFS_MP_ENABLED);
-                                    jsonPref.put("flush", true);
-                                    jsonPref.put("type", "string");
-                                    jsonPref.put("value", input1.getText().toString());
-
-                                    GeckoEvent event = GeckoEvent.createBroadcastEvent("Preferences:Set", jsonPref.toString());
-                                    GeckoAppShell.sendEventToGecko(event);
-                                } catch(Exception ex) {
-                                    Log.e(LOGTAG, "Error setting master password", ex);
-                                }
-                                return;
+                                PrefsHelper.setPref(PREFS_MP_ENABLED,
+                                                    input1.getText().toString(),
+                                                    /* flush */ true);
                             }
                         })
                         .setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
                             @Override
                             public void onClick(DialogInterface dialog, int which) {
                                 return;
                             }
                         });