Use new apply() instead of commit().
apply() starts an async disk write and doesn't have a return value but is otherwise identical in observable effects. Change-Id: I0f528607319d7eb5136bb11fce0b24d8741ccdf9
This commit is contained in:
@@ -144,7 +144,7 @@ public class BluetoothDiscoverableEnabler implements Preference.OnPreferenceChan
|
||||
private void persistDiscoverableEndTimestamp(long endTimestamp) {
|
||||
SharedPreferences.Editor editor = mLocalManager.getSharedPreferences().edit();
|
||||
editor.putLong(SHARED_PREFERENCES_KEY_DISCOVERABLE_END_TIMESTAMP, endTimestamp);
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
private void handleModeChanged(int mode) {
|
||||
|
@@ -199,6 +199,6 @@ public class BluetoothEventRedirector {
|
||||
SharedPreferences.Editor editor = mManager.getSharedPreferences().edit();
|
||||
editor.putLong(LocalBluetoothManager.SHARED_PREFERENCES_KEY_DISCOVERING_TIMESTAMP,
|
||||
System.currentTimeMillis());
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
@@ -788,14 +788,14 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli
|
||||
SharedPreferences.Editor editor = getSharedPreferences(SHARED_PREFERENCES_NAME,
|
||||
Context.MODE_PRIVATE).edit();
|
||||
editor.putBoolean(key, bool);
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
private void setSettingInt(String key, int value) {
|
||||
SharedPreferences.Editor editor = getSharedPreferences(SHARED_PREFERENCES_NAME,
|
||||
Context.MODE_PRIVATE).edit();
|
||||
editor.putInt(key, value);
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
private void removeSetting(String key) {
|
||||
@@ -803,8 +803,7 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli
|
||||
Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPref.edit();
|
||||
editor.remove(key);
|
||||
editor.commit();
|
||||
return;
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public synchronized void onServiceConnected() {
|
||||
|
@@ -356,7 +356,7 @@ public class LocalBluetoothManager {
|
||||
deviceAddress);
|
||||
editor.putLong(LocalBluetoothManager.SHARED_PREFERENCES_KEY_LAST_SELECTED_DEVICE_TIME,
|
||||
System.currentTimeMillis());
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public boolean hasDockAutoConnectSetting(String addr) {
|
||||
@@ -371,12 +371,12 @@ public class LocalBluetoothManager {
|
||||
public void saveDockAutoConnectSetting(String addr, boolean autoConnect) {
|
||||
SharedPreferences.Editor editor = getSharedPreferences().edit();
|
||||
editor.putBoolean(SHARED_PREFERENCES_KEY_DOCK_AUTO_CONNECT + addr, autoConnect);
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void removeDockAutoConnectSetting(String addr) {
|
||||
SharedPreferences.Editor editor = getSharedPreferences().edit();
|
||||
editor.remove(SHARED_PREFERENCES_KEY_DOCK_AUTO_CONNECT + addr);
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
@@ -277,7 +277,7 @@ public class RequestPermissionActivity extends Activity implements
|
||||
editor.putLong(
|
||||
BluetoothDiscoverableEnabler.SHARED_PREFERENCES_KEY_DISCOVERABLE_END_TIMESTAMP,
|
||||
endTimestamp);
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user