OSDN Git Service

Revert "Persist settings on a normal priority thread."
authorSvetoslav Ganov <svetoslavganov@google.com>
Fri, 13 Mar 2015 19:39:53 +0000 (19:39 +0000)
committerSvetoslav Ganov <svetoslavganov@google.com>
Tue, 17 Mar 2015 22:00:37 +0000 (22:00 +0000)
This reverts commit d289e64a2d7c8efba78b9066b647ee321eba701a.

Change-Id: Ic9455b538e0be8b9a4e4672f99b14978e70d2911

packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java

index 84e66ff..3bf6828 100644 (file)
@@ -17,7 +17,6 @@
 package com.android.providers.settings;
 
 import android.os.Handler;
-import android.os.HandlerThread;
 import android.os.Message;
 import android.os.SystemClock;
 import android.provider.Settings;
@@ -27,6 +26,7 @@ import android.util.AtomicFile;
 import android.util.Slog;
 import android.util.Xml;
 import com.android.internal.annotations.GuardedBy;
+import com.android.internal.os.BackgroundThread;
 import libcore.io.IoUtils;
 import libcore.util.Objects;
 import org.xmlpull.v1.XmlPullParser;
@@ -153,7 +153,7 @@ final class SettingsState {
         final int settingCount = mSettings.size();
         for (int i = settingCount - 1; i >= 0; i--) {
             String name = mSettings.keyAt(i);
-            // Settings defined by us are never dropped.
+            // Settings defined by use are never dropped.
             if (Settings.System.PUBLIC_SETTINGS.contains(name)
                     || Settings.System.PRIVATE_SETTINGS.contains(name)) {
                 continue;
@@ -494,7 +494,7 @@ final class SettingsState {
         public static final int MSG_PERSIST_SETTINGS = 1;
 
         public MyHandler() {
-            super(PersistThread.getInstance().getLooper());
+            super(BackgroundThread.getHandler().getLooper());
         }
 
         @Override
@@ -574,24 +574,4 @@ final class SettingsState {
             return true;
         }
     }
-
-    private static final class PersistThread extends HandlerThread {
-        private static final Object sLock = new Object();
-
-        private static PersistThread sInstance;
-
-        private PersistThread() {
-            super("settings.persist");
-        }
-
-        public static PersistThread getInstance() {
-            synchronized (sLock) {
-                if (sInstance == null) {
-                    sInstance = new PersistThread();
-                    sInstance.start();
-                }
-                return sInstance;
-            }
-        }
-    }
 }