From 4714a1cf1d211aad2d8cf1802f85f649e744beb0 Mon Sep 17 00:00:00 2001 From: Wu-cheng Li Date: Wed, 8 Sep 2010 11:12:43 -0700 Subject: Use SharedPreferences$Editor.apply to reduce latency. Replace all commit with apply. bug:2978683 Change-Id: I6c057fab588aada7c35d03f6237fb850d2a2e856 --- src/com/android/camera/CameraSettings.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/com/android/camera/CameraSettings.java') diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 3bebb93..29eb187 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -100,7 +100,7 @@ public class CameraSettings { SharedPreferences.Editor editor = ComboPreferences .get(context).edit(); editor.putString(KEY_PICTURE_SIZE, candidate); - editor.commit(); + editor.apply(); return; } } @@ -272,7 +272,7 @@ public class CameraSettings { if (version == CURRENT_LOCAL_VERSION) return; SharedPreferences.Editor editor = pref.edit(); editor.putInt(KEY_LOCAL_VERSION, CURRENT_LOCAL_VERSION); - editor.commit(); + editor.apply(); } public static void upgradeGlobalPreferences(SharedPreferences pref) { @@ -317,7 +317,7 @@ public class CameraSettings { editor.remove("pref_camera_video_duration_key"); } editor.putInt(KEY_VERSION, CURRENT_VERSION); - editor.commit(); + editor.apply(); } public static void upgradeAllPreferences(ComboPreferences pref) { @@ -347,6 +347,6 @@ public class CameraSettings { int cameraId) { Editor editor = pref.edit(); editor.putInt(KEY_CAMERA_ID, cameraId); - editor.commit(); + editor.apply(); } } -- cgit v1.1