diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 14:04:24 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 14:04:24 -0800 |
commit | 076357b8567458d4b6dfdcf839ef751634cd2bfb (patch) | |
tree | efbb2fd6f1dc67d2d606382fc3b82983e7cb2e1f /packages | |
parent | 3dec7d563a2f3e1eb967ce2054a00b6620e3558c (diff) | |
download | frameworks_base-076357b8567458d4b6dfdcf839ef751634cd2bfb.zip frameworks_base-076357b8567458d4b6dfdcf839ef751634cd2bfb.tar.gz frameworks_base-076357b8567458d4b6dfdcf839ef751634cd2bfb.tar.bz2 |
auto import from //depot/cupcake/@132589
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 32 | ||||
-rw-r--r-- | packages/SubscribedFeedsProvider/AndroidManifest.xml | 5 | ||||
-rw-r--r-- | packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsBroadcastReceiver.java | 41 | ||||
-rw-r--r-- | packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsService.java (renamed from packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java) | 98 |
4 files changed, 65 insertions, 111 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index f8b5700..90acd41 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -27,6 +27,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteStatement; +import android.location.LocationManager; import android.media.AudioManager; import android.media.AudioService; import android.net.ConnectivityManager; @@ -63,7 +64,7 @@ class DatabaseHelper extends SQLiteOpenHelper { private static final String TAG = "SettingsProvider"; private static final String DATABASE_NAME = "settings.db"; - private static final int DATABASE_VERSION = 33; + private static final int DATABASE_VERSION = 32; private Context mContext; @@ -353,24 +354,6 @@ class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 32; } - if (upgradeVersion == 32) { - // The Wi-Fi watchdog SSID list is now seeded with the value of - // the property ro.com.android.wifi-watchlist - String wifiWatchList = SystemProperties.get("ro.com.android.wifi-watchlist"); - if (!TextUtils.isEmpty(wifiWatchList)) { - db.beginTransaction(); - try { - db.execSQL("INSERT OR IGNORE INTO secure(name,value) values('" + - Settings.Secure.WIFI_WATCHDOG_WATCH_LIST + "','" + - wifiWatchList + "');"); - db.setTransactionSuccessful(); - } finally { - db.endTransaction(); - } - } - upgradeVersion = 33; - } - if (upgradeVersion != currentVersion) { Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion + ", must wipe the settings provider"); @@ -636,20 +619,11 @@ class DatabaseHelper extends SQLiteOpenHelper { R.bool.def_wifi_on); loadBooleanSetting(stmt, Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, R.bool.def_networks_available_notification_on); - - String wifiWatchList = SystemProperties.get("ro.com.android.wifi-watchlist"); - if (!TextUtils.isEmpty(wifiWatchList)) { - loadSetting(stmt, Settings.Secure.WIFI_WATCHDOG_WATCH_LIST, wifiWatchList); - } - + // Don't do this. The SystemServer will initialize ADB_ENABLED from a // persistent system property instead. //loadSetting(stmt, Settings.Secure.ADB_ENABLED, 0); - // Allow mock locations default, based on build - loadSetting(stmt, Settings.Secure.ALLOW_MOCK_LOCATION, - "1".equals(SystemProperties.get("ro.allow.mock.location")) ? 1 : 0); - stmt.close(); } diff --git a/packages/SubscribedFeedsProvider/AndroidManifest.xml b/packages/SubscribedFeedsProvider/AndroidManifest.xml index 6ecda48..94c4be5 100644 --- a/packages/SubscribedFeedsProvider/AndroidManifest.xml +++ b/packages/SubscribedFeedsProvider/AndroidManifest.xml @@ -6,7 +6,7 @@ <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" /> <uses-permission android:name="android.permission.SUBSCRIBED_FEEDS_READ" /> <uses-permission android:name="android.permission.SUBSCRIBED_FEEDS_WRITE" /> - + <application android:process="system" android:allowClearUserData="false" android:icon="@drawable/app_icon" @@ -17,7 +17,7 @@ android:multiprocess="false" android:readPermission="android.permission.SUBSCRIBED_FEEDS_READ" android:writePermission="android.permission.SUBSCRIBED_FEEDS_WRITE" /> - <receiver android:name="SubscribedFeedsBroadcastReceiver"> + <receiver android:name="SubscribedFeedsService"> <intent-filter> <action android:name="android.intent.action.GTALK_DATA_MESSAGE_RECEIVED" /> <category android:name="GSYNC_TICKLE"/> @@ -29,6 +29,5 @@ <action android:name="com.android.subscribedfeeds.action.REFRESH" /> </intent-filter> </receiver> - <service android:name="SubscribedFeedsIntentService"/> </application> </manifest> diff --git a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsBroadcastReceiver.java b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsBroadcastReceiver.java deleted file mode 100644 index 3513215..0000000 --- a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsBroadcastReceiver.java +++ /dev/null @@ -1,41 +0,0 @@ -/* -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -package com.android.providers.subscribedfeeds; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -/** - * Handles the XMPP_CONNECTED_ACTION intent by updating all the - * subscribed feeds with the new jabber id and initiating a sync - * for all subscriptions. - * - * Handles the TICKLE_ACTION intent by finding the matching - * subscribed feed and intiating a sync for it. - */ -public class SubscribedFeedsBroadcastReceiver extends BroadcastReceiver { - - private static final String TAG = "Sync"; - - public void onReceive(Context context, Intent intent) { - if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "Received intent " + intent); - intent.setClass(context, SubscribedFeedsIntentService.class); - context.startService(intent); - } -} diff --git a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsService.java index df599c7..8d6e272 100644 --- a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java +++ b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsService.java @@ -1,35 +1,62 @@ +/* +** Copyright 2006, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + package com.android.providers.subscribedfeeds; -import android.content.Intent; -import android.content.Context; +import android.app.AlarmManager; +import android.app.PendingIntent; +import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.ContentValues; +import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; -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; import android.database.sqlite.SQLiteFullException; -import android.app.AlarmManager; -import android.app.PendingIntent; +import android.net.Uri; import android.os.Bundle; -import android.os.Debug; +import android.provider.SubscribedFeeds; +import android.provider.Sync; +import android.provider.SyncConstValue; import android.text.TextUtils; -import android.net.Uri; +import android.util.Config; +import android.util.EventLog; +import android.util.Log; import java.util.ArrayList; import java.util.Calendar; /** - * A service to handle various intents asynchronously. + * Handles the XMPP_CONNECTED_ACTION intent by updating all the + * subscribed feeds with the new jabber id and initiating a sync + * for all subscriptions. + * + * Handles the TICKLE_ACTION intent by finding the matching + * subscribed feed and intiating a sync for it. */ -public class SubscribedFeedsIntentService extends IntentService { +public class SubscribedFeedsService extends BroadcastReceiver { + private static final String TAG = "Sync"; + private static final String SUBSCRIBED_FEEDS_REFRESH_ACTION = + "com.android.subscribedfeeds.action.REFRESH"; + + private static final Intent sSubscribedFeedsRefreshIntent = + new Intent(SUBSCRIBED_FEEDS_REFRESH_ACTION); + private static final String[] sAccountProjection = new String[] {SubscribedFeeds.Accounts._SYNC_ACCOUNT}; @@ -40,20 +67,11 @@ public class SubscribedFeedsIntentService extends IntentService { private static final String sSubscribedFeedsPrefs = "subscribedFeeds"; - private static final String GTALK_DATA_MESSAGE_RECEIVED = - "android.intent.action.GTALK_DATA_MESSAGE_RECEIVED"; + static final int LOG_TICKLE = 2742; - private static final String SUBSCRIBED_FEEDS_REFRESH_ACTION = - "com.android.subscribedfeeds.action.REFRESH"; - - private static final int LOG_TICKLE = 2742; - - public SubscribedFeedsIntentService() { - super("SubscribedFeedsIntentService"); - } - - protected void onHandleIntent(Intent intent) { - if (GTALK_DATA_MESSAGE_RECEIVED.equals(intent.getAction())) { + public void onReceive(Context context, Intent intent) { + if ("android.intent.action.GTALK_DATA_MESSAGE_RECEIVED".equals( + intent.getAction())) { boolean fromTrustedServer = intent.getBooleanExtra("from_trusted_server", false); if (fromTrustedServer) { String account = intent.getStringExtra("account"); @@ -71,7 +89,7 @@ public class SubscribedFeedsIntentService extends IntentService { + account + " - " + token); } - handleTickle(this, account, token); + handleTickle(context, account, token); } else { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "Ignoring tickle -- not from trusted server."); @@ -84,23 +102,25 @@ public class SubscribedFeedsIntentService extends IntentService { Log.d(TAG, "Received boot completed action"); } // load the time from the shared preferences and schedule an alarm - long refreshTime = getSharedPreferences( + long refreshTime = context.getSharedPreferences( sSubscribedFeedsPrefs, Context.MODE_WORLD_READABLE).getLong(sRefreshTime, 0); - scheduleRefresh(this, refreshTime); - } else if (SUBSCRIBED_FEEDS_REFRESH_ACTION.equals(intent.getAction())) { + scheduleRefresh(context, refreshTime); + } else if (sSubscribedFeedsRefreshIntent.getAction().equals( + intent.getAction())) { if (Config.LOGD) { Log.d(TAG, "Received sSubscribedFeedsRefreshIntent"); } - handleRefreshAlarm(this); + handleRefreshAlarm(context); } } + private void scheduleRefresh(Context context, long when) { AlarmManager alarmManager = (AlarmManager) context.getSystemService( Context.ALARM_SERVICE); - PendingIntent pendingIntent = PendingIntent.getBroadcast(context, - 0, new Intent(SUBSCRIBED_FEEDS_REFRESH_ACTION), 0); - alarmManager.set(AlarmManager.RTC, when, pendingIntent); + PendingIntent sender = PendingIntent.getBroadcast(context, + 0, sSubscribedFeedsRefreshIntent, 0); + alarmManager.set(AlarmManager.RTC, when, sender); } private void handleTickle(Context context, String account, String feed) { @@ -184,8 +204,10 @@ public class SubscribedFeedsIntentService extends IntentService { // Schedule a refresh. long refreshTime = Calendar.getInstance().getTimeInMillis() + SUBSCRIPTION_REFRESH_INTERVAL; scheduleRefresh(context, refreshTime); - SharedPreferences.Editor editor = context.getSharedPreferences(sSubscribedFeedsPrefs, - Context.MODE_WORLD_READABLE).edit(); + SharedPreferences preferences = context + .getSharedPreferences(sSubscribedFeedsPrefs, + Context.MODE_WORLD_READABLE); + SharedPreferences.Editor editor = preferences.edit(); editor.putLong(sRefreshTime, refreshTime); editor.commit(); } |