summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-04-27 17:10:36 -0700
committerDianne Hackborn <hackbod@google.com>2009-05-05 15:40:53 -0700
commit231cc608d06ffc31c24bf8aa8c8275bdd2636581 (patch)
tree9b435c670f0f16751a21ae4678bfbed7d8e159b4 /packages
parent06d96020c35dac2bf1651cb8bd4cfced911f1142 (diff)
downloadframeworks_base-231cc608d06ffc31c24bf8aa8c8275bdd2636581.zip
frameworks_base-231cc608d06ffc31c24bf8aa8c8275bdd2636581.tar.gz
frameworks_base-231cc608d06ffc31c24bf8aa8c8275bdd2636581.tar.bz2
Rewrite SyncStorageEngine to use flat files and in-memory data structures.
The previous implementation used a database for storing all of its state, which could cause a significant amount of IO activity as its tables were updated through the stages of a sync. This new implementation replaces that in-memory data structures, with hand-written code for writing them to persistent storage. There are now 4 files associated with this class, holding various pieces of its state that should be consistent. These are everything from a main XML file of account information that must always be retained, to a binary file of per-day statistics that can be thrown away at any time. Writes of these files as scheduled at various times based on their importance of the frequency at which they change. Because the database no longer exists, there needs to be a new explicit interface for interacting with the sync manager database. This is provided by new APIs on IContentService, with a hidden method on ContentResolver to retrieve the IContentService so that various system entities can use it. Other changes in other projects are required to update to the new API. The goal here is to have as little an impact on the code and functionality outside of SyncStorageEngine, though due to the necessary change in API it is still somewhat extensive.
Diffstat (limited to 'packages')
-rw-r--r--packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java
index df599c7..8b3bedf 100644
--- a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java
+++ b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java
@@ -9,7 +9,6 @@ import android.util.Log;
import android.util.Config;
import android.util.EventLog;
import android.app.IntentService;
-import android.provider.Sync;
import android.provider.SubscribedFeeds;
import android.provider.SyncConstValue;
import android.database.Cursor;
@@ -17,7 +16,7 @@ import android.database.sqlite.SQLiteFullException;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.os.Bundle;
-import android.os.Debug;
+import android.os.RemoteException;
import android.text.TextUtils;
import android.net.Uri;
@@ -105,10 +104,6 @@ public class SubscribedFeedsIntentService extends IntentService {
private void handleTickle(Context context, String account, String feed) {
Cursor c = null;
- Sync.Settings.QueryMap syncSettings =
- new Sync.Settings.QueryMap(context.getContentResolver(),
- false /* don't keep updated */,
- null /* not needed since keep updated is false */);
final String where = SubscribedFeeds.Feeds._SYNC_ACCOUNT + "= ? "
+ "and " + SubscribedFeeds.Feeds.FEED + "= ?";
try {
@@ -124,9 +119,14 @@ public class SubscribedFeedsIntentService extends IntentService {
String authority = c.getString(c.getColumnIndexOrThrow(
SubscribedFeeds.Feeds.AUTHORITY));
EventLog.writeEvent(LOG_TICKLE, authority);
- if (!syncSettings.getSyncProviderAutomatically(authority)) {
- Log.d(TAG, "supressing tickle since provider " + authority
- + " is configured to not sync automatically");
+ try {
+ if (!ContentResolver.getContentService()
+ .getSyncProviderAutomatically(authority)) {
+ Log.d(TAG, "supressing tickle since provider " + authority
+ + " is configured to not sync automatically");
+ continue;
+ }
+ } catch (RemoteException e) {
continue;
}
Uri uri = Uri.parse("content://" + authority);
@@ -137,7 +137,6 @@ public class SubscribedFeedsIntentService extends IntentService {
}
} finally {
if (c != null) c.deactivate();
- syncSettings.close();
}
}