diff --git a/packages/SubscribedFeedsProvider/Android.mk b/packages/SubscribedFeedsProvider/Android.mk deleted file mode 100644 index bed6a168655a0..0000000000000 --- a/packages/SubscribedFeedsProvider/Android.mk +++ /dev/null @@ -1,11 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := user - -LOCAL_SRC_FILES := $(call all-subdir-java-files) - -LOCAL_PACKAGE_NAME := SubscribedFeedsProvider -LOCAL_CERTIFICATE := platform - -include $(BUILD_PACKAGE) diff --git a/packages/SubscribedFeedsProvider/AndroidManifest.xml b/packages/SubscribedFeedsProvider/AndroidManifest.xml deleted file mode 100644 index a3938bd5f1d5d..0000000000000 --- a/packages/SubscribedFeedsProvider/AndroidManifest.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/SubscribedFeedsProvider/MODULE_LICENSE_APACHE2 b/packages/SubscribedFeedsProvider/MODULE_LICENSE_APACHE2 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/SubscribedFeedsProvider/NOTICE b/packages/SubscribedFeedsProvider/NOTICE deleted file mode 100644 index c5b1efa7aac76..0000000000000 --- a/packages/SubscribedFeedsProvider/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2005-2008, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/packages/SubscribedFeedsProvider/res/drawable/app_icon.png b/packages/SubscribedFeedsProvider/res/drawable/app_icon.png deleted file mode 100644 index 13d8cdd4644d5..0000000000000 Binary files a/packages/SubscribedFeedsProvider/res/drawable/app_icon.png and /dev/null differ diff --git a/packages/SubscribedFeedsProvider/res/values-cs/strings.xml b/packages/SubscribedFeedsProvider/res/values-cs/strings.xml deleted file mode 100644 index 5b06f7b0b17f1..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-cs/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Synchronizace zdrojů" - "Zobrazit odběry" - diff --git a/packages/SubscribedFeedsProvider/res/values-da/strings.xml b/packages/SubscribedFeedsProvider/res/values-da/strings.xml deleted file mode 100644 index f8867a26e7219..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-da/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Synkroniser feeds" - "Push-abonnementer" - diff --git a/packages/SubscribedFeedsProvider/res/values-de/strings.xml b/packages/SubscribedFeedsProvider/res/values-de/strings.xml deleted file mode 100644 index 8bfd7219a0292..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-de/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Feedsynchronisierung" - "Push-Abos" - diff --git a/packages/SubscribedFeedsProvider/res/values-el/strings.xml b/packages/SubscribedFeedsProvider/res/values-el/strings.xml deleted file mode 100644 index 11a3486e55dbd..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-el/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Συγχρονισμός ροών δεδομένων" - "Προώθηση συνδρομών" - diff --git a/packages/SubscribedFeedsProvider/res/values-es-rUS/strings.xml b/packages/SubscribedFeedsProvider/res/values-es-rUS/strings.xml deleted file mode 100644 index 75f1b9f4c0b1b..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-es-rUS/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Canales de sincronización" - "Suscripciones de inserción" - diff --git a/packages/SubscribedFeedsProvider/res/values-es/strings.xml b/packages/SubscribedFeedsProvider/res/values-es/strings.xml deleted file mode 100644 index 59d169382d44e..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-es/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Sincronización de feeds" - "Enviar suscripciones" - diff --git a/packages/SubscribedFeedsProvider/res/values-fr/strings.xml b/packages/SubscribedFeedsProvider/res/values-fr/strings.xml deleted file mode 100644 index ab1aae902c1f4..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-fr/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Synchronisation des flux" - "Abonnements Push" - diff --git a/packages/SubscribedFeedsProvider/res/values-it/strings.xml b/packages/SubscribedFeedsProvider/res/values-it/strings.xml deleted file mode 100644 index 2a6dd54faaa73..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-it/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Sincronizzazione feed" - "Sottoscrizioni push" - diff --git a/packages/SubscribedFeedsProvider/res/values-ja/strings.xml b/packages/SubscribedFeedsProvider/res/values-ja/strings.xml deleted file mode 100644 index 6a0812aafd3e6..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-ja/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "フィードの同期" - "プッシュ型登録" - diff --git a/packages/SubscribedFeedsProvider/res/values-ko/strings.xml b/packages/SubscribedFeedsProvider/res/values-ko/strings.xml deleted file mode 100644 index 09127321b219d..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-ko/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "피드 동기화" - "구독정보 푸시" - diff --git a/packages/SubscribedFeedsProvider/res/values-nb/strings.xml b/packages/SubscribedFeedsProvider/res/values-nb/strings.xml deleted file mode 100644 index 30a2c5ea96368..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-nb/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Strømsynkronisering" - "Push-abonnementer" - diff --git a/packages/SubscribedFeedsProvider/res/values-nl/strings.xml b/packages/SubscribedFeedsProvider/res/values-nl/strings.xml deleted file mode 100644 index b74e66b72e3b9..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-nl/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Feeds synchroniseren" - "Abonnementen doorvoeren" - diff --git a/packages/SubscribedFeedsProvider/res/values-pl/strings.xml b/packages/SubscribedFeedsProvider/res/values-pl/strings.xml deleted file mode 100644 index ed6c1d0e1c6c7..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-pl/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Synchronizowanie kanałów" - "Subskrypcje w trybie push" - diff --git a/packages/SubscribedFeedsProvider/res/values-pt-rPT/strings.xml b/packages/SubscribedFeedsProvider/res/values-pt-rPT/strings.xml deleted file mode 100644 index 29f69aca7c002..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-pt-rPT/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Sincronizar feeds" - "Transferir Subscrições" - diff --git a/packages/SubscribedFeedsProvider/res/values-pt/strings.xml b/packages/SubscribedFeedsProvider/res/values-pt/strings.xml deleted file mode 100644 index 081190dabedeb..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-pt/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Sincronizar feeds" - "Enviar inscrições" - diff --git a/packages/SubscribedFeedsProvider/res/values-ru/strings.xml b/packages/SubscribedFeedsProvider/res/values-ru/strings.xml deleted file mode 100644 index 24ead0aa06c73..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-ru/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Фиды синхронизации" - "Подписки Push" - diff --git a/packages/SubscribedFeedsProvider/res/values-sv/strings.xml b/packages/SubscribedFeedsProvider/res/values-sv/strings.xml deleted file mode 100644 index 55499c5a543f1..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-sv/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Synkroniseringsflöden" - "Push-prenumerationer" - diff --git a/packages/SubscribedFeedsProvider/res/values-tr/strings.xml b/packages/SubscribedFeedsProvider/res/values-tr/strings.xml deleted file mode 100644 index baa333004cc38..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-tr/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "Senkronizasyon Yayınları" - "Abonelik Şart Koş" - diff --git a/packages/SubscribedFeedsProvider/res/values-zh-rCN/strings.xml b/packages/SubscribedFeedsProvider/res/values-zh-rCN/strings.xml deleted file mode 100644 index 05edb805bb2f7..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-zh-rCN/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "同步供稿" - "推送订阅" - diff --git a/packages/SubscribedFeedsProvider/res/values-zh-rTW/strings.xml b/packages/SubscribedFeedsProvider/res/values-zh-rTW/strings.xml deleted file mode 100644 index 5e5bcc5c4d2ea..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values-zh-rTW/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - "同步資訊提供" - "預先載入訂閱項目" - diff --git a/packages/SubscribedFeedsProvider/res/values/strings.xml b/packages/SubscribedFeedsProvider/res/values/strings.xml deleted file mode 100644 index c4c2484380a05..0000000000000 --- a/packages/SubscribedFeedsProvider/res/values/strings.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - Sync Feeds - - - Push Subscriptions - - - 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 ea14307d7defa..0000000000000 --- a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsBroadcastReceiver.java +++ /dev/null @@ -1,45 +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.app.Activity; -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); - if (intent.getAction().equals(Intent.ACTION_REMOTE_INTENT)) { - setResultCode(Activity.RESULT_OK); - } - 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/SubscribedFeedsIntentService.java deleted file mode 100644 index 2e910b7cbe91a..0000000000000 --- a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.android.providers.subscribedfeeds; - -import android.content.Intent; -import android.content.Context; -import android.content.ContentResolver; -import android.content.ContentValues; -import android.content.SharedPreferences; -import android.util.Log; -import android.util.Config; -import android.util.EventLog; -import android.app.IntentService; -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.os.Bundle; -import android.text.TextUtils; -import android.accounts.Account; - -import java.util.ArrayList; -import java.util.Calendar; - -import com.google.android.collect.Lists; - -/** - * A service to handle various intents asynchronously. - */ -public class SubscribedFeedsIntentService extends IntentService { - private static final String TAG = "Sync"; - - private static final String[] sAccountProjection = - new String[] {SubscribedFeeds.Accounts._SYNC_ACCOUNT, - SubscribedFeeds.Accounts._SYNC_ACCOUNT_TYPE}; - - /** How often to refresh the subscriptions, in milliseconds */ - private static final long SUBSCRIPTION_REFRESH_INTERVAL = 1000L * 60 * 60 * 24; // one day - - private static final String sRefreshTime = "refreshTime"; - - private static final String sSubscribedFeedsPrefs = "subscribedFeeds"; - - private static final String REMOTE_INTENT_ACTION = Intent.ACTION_REMOTE_INTENT; - - 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 (REMOTE_INTENT_ACTION.equals(intent.getAction())) { - boolean fromTrustedServer = intent.getBooleanExtra( - "android.intent.extra.from_trusted_server", false); - if (fromTrustedServer) { - String accountName = intent.getStringExtra("account"); - String token = intent.getStringExtra(Intent.EXTRA_REMOTE_INTENT_TOKEN); - - if (TextUtils.isEmpty(accountName) || TextUtils.isEmpty(token)) { - if (Config.LOGD) { - Log.d(TAG, "Ignoring malformed tickle -- missing account or token."); - } - return; - } - - if (Config.LOGD) { - Log.d(TAG, "Received network tickle for " - + accountName + " - " + token); - } - - handleTickle(this, accountName, token); - } else { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "Ignoring tickle -- not from trusted server."); - } - } - - } else if (Intent.ACTION_BOOT_COMPLETED.equals( - intent.getAction())) { - if (Config.LOGD) { - Log.d(TAG, "Received boot completed action"); - } - // load the time from the shared preferences and schedule an alarm - long refreshTime = getSharedPreferences( - sSubscribedFeedsPrefs, - Context.MODE_WORLD_READABLE).getLong(sRefreshTime, 0); - scheduleRefresh(this, refreshTime); - } else if (SUBSCRIBED_FEEDS_REFRESH_ACTION.equals(intent.getAction())) { - if (Config.LOGD) { - Log.d(TAG, "Received sSubscribedFeedsRefreshIntent"); - } - handleRefreshAlarm(this); - } - } - 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); - } - - private void handleTickle(Context context, String accountName, String feed) { - Cursor c = null; - final String where = SubscribedFeeds.Feeds._SYNC_ACCOUNT + "= ? " - + "and " + SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE + "= ? " - + "and " + SubscribedFeeds.Feeds.FEED + "= ?"; - try { - // TODO(fredq) fix the hardcoded type - final Account account = new Account(accountName, "com.google"); - c = context.getContentResolver().query(SubscribedFeeds.Feeds.CONTENT_URI, - null, where, new String[]{account.name, account.type, feed}, null); - if (c.getCount() == 0) { - Log.w(TAG, "received tickle for non-existent feed: " - + "account " + accountName + ", feed " + feed); - EventLog.writeEvent(LOG_TICKLE, "unknown"); - } - while (c.moveToNext()) { - // initiate a sync - String authority = c.getString(c.getColumnIndexOrThrow( - SubscribedFeeds.Feeds.AUTHORITY)); - EventLog.writeEvent(LOG_TICKLE, authority); - if (!ContentResolver.getSyncAutomatically(account, authority)) { - Log.d(TAG, "supressing tickle since provider " + authority - + " is configured to not sync automatically"); - continue; - } - Bundle extras = new Bundle(); - extras.putString("feed", feed); - ContentResolver.requestSync(account, authority, extras); - } - } finally { - if (c != null) c.deactivate(); - } - } - - /** - * Cause all the subscribed feeds to be marked dirty and their - * authtokens to be refreshed, which will result in new authtokens - * being sent to the subscription server. Then reschedules this - * event for one week in the future. - * - * @param context Context we are running within - */ - private void handleRefreshAlarm(Context context) { - // retrieve the list of accounts from the subscribed feeds - ArrayList accounts = Lists.newArrayList(); - ContentResolver contentResolver = context.getContentResolver(); - Cursor c = contentResolver.query(SubscribedFeeds.Accounts.CONTENT_URI, - sAccountProjection, null, null, null); - try { - while (c.moveToNext()) { - String accountName = c.getString(0); - String accountType = c.getString(1); - accounts.add(new Account(accountName, accountType)); - } - } finally { - c.close(); - } - - // Clear the auth tokens for all these accounts so that we are sure - // they will still be valid until the next time we refresh them. - // TODO(fredq): add this when the google login service is done - - // mark the feeds dirty, by setting the accounts to the same value, - // which will trigger a sync. - try { - ContentValues values = new ContentValues(); - for (Account account : accounts) { - values.put(SyncConstValue._SYNC_ACCOUNT, account.name); - values.put(SyncConstValue._SYNC_ACCOUNT_TYPE, account.type); - contentResolver.update(SubscribedFeeds.Feeds.CONTENT_URI, values, - SubscribedFeeds.Feeds._SYNC_ACCOUNT + "=? AND " - + SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE + "=?", - new String[] {account.name, account.type}); - } - } catch (SQLiteFullException e) { - Log.w(TAG, "disk full while trying to mark the feeds as dirty, skipping"); - } - - // 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(); - editor.putLong(sRefreshTime, refreshTime); - editor.commit(); - } -} diff --git a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java deleted file mode 100644 index 8585082852934..0000000000000 --- a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java +++ /dev/null @@ -1,391 +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.accounts.Account; -import android.content.UriMatcher; -import android.content.*; -import android.database.Cursor; -import android.database.DatabaseUtils; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteQueryBuilder; -import android.net.Uri; -import android.provider.SubscribedFeeds; -import android.text.TextUtils; -import android.util.Config; -import android.util.Log; - -import java.util.Collections; -import java.util.Map; -import java.util.HashMap; - -/** - * Manages a list of feeds for which this client is interested in receiving - * change notifications. - */ -public class SubscribedFeedsProvider extends AbstractSyncableContentProvider { - private static final String TAG = "SubscribedFeedsProvider"; - private static final String DATABASE_NAME = "subscribedfeeds.db"; - private static final int DATABASE_VERSION = 11; - - private static final int FEEDS = 1; - private static final int FEED_ID = 2; - private static final int DELETED_FEEDS = 3; - private static final int ACCOUNTS = 4; - - private static final Map ACCOUNTS_PROJECTION_MAP; - - private static final UriMatcher sURLMatcher = - new UriMatcher(UriMatcher.NO_MATCH); - - private static String sFeedsTable = "feeds"; - private static Uri sFeedsUrl = - Uri.parse("content://subscribedfeeds/feeds/"); - private static String sDeletedFeedsTable = "_deleted_feeds"; - private static Uri sDeletedFeedsUrl = - Uri.parse("content://subscribedfeeds/deleted_feeds/"); - - public SubscribedFeedsProvider() { - super(DATABASE_NAME, DATABASE_VERSION, sFeedsUrl); - } - - static { - sURLMatcher.addURI("subscribedfeeds", "feeds", FEEDS); - sURLMatcher.addURI("subscribedfeeds", "feeds/#", FEED_ID); - sURLMatcher.addURI("subscribedfeeds", "deleted_feeds", DELETED_FEEDS); - sURLMatcher.addURI("subscribedfeeds", "accounts", ACCOUNTS); - } - - @Override - protected boolean upgradeDatabase(SQLiteDatabase db, - int oldVersion, int newVersion) { - Log.w(TAG, "Upgrading database from version " + oldVersion + - " to " + newVersion + - ", which will destroy all old data"); - db.execSQL("DROP TRIGGER IF EXISTS feed_cleanup"); - db.execSQL("DROP TABLE IF EXISTS _deleted_feeds"); - db.execSQL("DROP TABLE IF EXISTS feeds"); - bootstrapDatabase(db); - return false; // this was lossy - } - - @Override - protected void bootstrapDatabase(SQLiteDatabase db) { - super.bootstrapDatabase(db); - db.execSQL("CREATE TABLE feeds (" + - "_id INTEGER PRIMARY KEY," + - "_sync_account TEXT," + // From the sync source - "_sync_account_type TEXT," + // From the sync source - "_sync_id TEXT," + // From the sync source - "_sync_time TEXT," + // From the sync source - "_sync_version TEXT," + // From the sync source - "_sync_local_id INTEGER," + // Used while syncing, - // never stored persistently - "_sync_dirty INTEGER," + // if syncable, set if the record - // has local, unsynced, changes - "_sync_mark INTEGER," + // Used to filter out new rows - "feed TEXT," + - "authority TEXT," + - "service TEXT" + - ");"); - - // Trigger to completely remove feeds data when they're deleted - db.execSQL("CREATE TRIGGER feed_cleanup DELETE ON feeds " + - "WHEN old._sync_id is not null " + - "BEGIN " + - "INSERT INTO _deleted_feeds " + - "(_sync_id, _sync_account, _sync_account_type, _sync_version) " + - "VALUES (old._sync_id, old._sync_account, old._sync_account_type, " + - "old._sync_version);" + - "END"); - - db.execSQL("CREATE TABLE _deleted_feeds (" + - "_sync_version TEXT," + // From the sync source - "_sync_id TEXT," + - (isTemporary() ? "_sync_local_id INTEGER," : "") + // Used while syncing, - "_sync_account TEXT," + - "_sync_account_type TEXT," + - "_sync_mark INTEGER, " + // Used to filter out new rows - "UNIQUE(_sync_id))"); - } - - @Override - protected void onAccountsChanged(Account[] accountsArray) { - super.onAccountsChanged(accountsArray); - for (Account account : accountsArray) { - if (account.type.equals("com.google")) { - ContentResolver.setSyncAutomatically(account, "subscribedfeeds", true); - } - } - } - - @Override - protected void onDatabaseOpened(SQLiteDatabase db) { - db.markTableSyncable("feeds", "_deleted_feeds"); - } - - @Override - protected Iterable getMergers() { - return Collections.singletonList(new FeedMerger()); - } - - @Override - public String getType(Uri url) { - int match = sURLMatcher.match(url); - switch (match) { - case FEEDS: - return SubscribedFeeds.Feeds.CONTENT_TYPE; - case FEED_ID: - return SubscribedFeeds.Feeds.CONTENT_ITEM_TYPE; - default: - throw new IllegalArgumentException("Unknown URL"); - } - } - - @Override - public Cursor queryInternal(Uri url, String[] projection, - String selection, String[] selectionArgs, String sortOrder) { - SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); - - - // Generate the body of the query - int match = sURLMatcher.match(url); - - if (Config.LOGV) Log.v(TAG, "SubscribedFeedsProvider.query: url=" + - url + ", match is " + match); - - switch (match) { - case FEEDS: - qb.setTables(sFeedsTable); - break; - case DELETED_FEEDS: - if (!isTemporary()) { - throw new UnsupportedOperationException(); - } - qb.setTables(sDeletedFeedsTable); - break; - case ACCOUNTS: - qb.setTables(sFeedsTable); - qb.setDistinct(true); - qb.setProjectionMap(ACCOUNTS_PROJECTION_MAP); - return qb.query(getDatabase(), projection, selection, selectionArgs, - SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE + "," - + SubscribedFeeds.Feeds._SYNC_ACCOUNT, null, sortOrder); - case FEED_ID: - qb.setTables(sFeedsTable); - qb.appendWhere(sFeedsTable + "._id="); - qb.appendWhere(url.getPathSegments().get(1)); - break; - default: - throw new IllegalArgumentException("Unknown URL " + url); - } - - // run the query - return qb.query(getDatabase(), projection, selection, selectionArgs, - null, null, sortOrder); - } - - @Override - public Uri insertInternal(Uri url, ContentValues initialValues) { - final SQLiteDatabase db = getDatabase(); - Uri resultUri = null; - long rowID; - - int match = sURLMatcher.match(url); - switch (match) { - case FEEDS: - ContentValues values = new ContentValues(initialValues); - values.put(SubscribedFeeds.Feeds._SYNC_DIRTY, 1); - rowID = db.insert(sFeedsTable, "feed", values); - if (rowID > 0) { - resultUri = Uri.parse( - "content://subscribedfeeds/feeds/" + rowID); - } - break; - - case DELETED_FEEDS: - if (!isTemporary()) { - throw new UnsupportedOperationException(); - } - rowID = db.insert(sDeletedFeedsTable, "_sync_id", - initialValues); - if (rowID > 0) { - resultUri = Uri.parse( - "content://subscribedfeeds/deleted_feeds/" + rowID); - } - break; - - default: - throw new UnsupportedOperationException( - "Cannot insert into URL: " + url); - } - - return resultUri; - } - - @Override - public int deleteInternal(Uri url, String userWhere, String[] whereArgs) { - final SQLiteDatabase db = getDatabase(); - String changedItemId; - - switch (sURLMatcher.match(url)) { - case FEEDS: - changedItemId = null; - break; - case FEED_ID: - changedItemId = url.getPathSegments().get(1); - break; - default: - throw new UnsupportedOperationException( - "Cannot delete that URL: " + url); - } - - String where = addIdToWhereClause(changedItemId, userWhere); - return db.delete(sFeedsTable, where, whereArgs); - } - - @Override - public int updateInternal(Uri url, ContentValues initialValues, - String userWhere, String[] whereArgs) { - final SQLiteDatabase db = getDatabase(); - ContentValues values = new ContentValues(initialValues); - values.put(SubscribedFeeds.Feeds._SYNC_DIRTY, 1); - - String changedItemId; - switch (sURLMatcher.match(url)) { - case FEEDS: - changedItemId = null; - break; - - case FEED_ID: - changedItemId = url.getPathSegments().get(1); - break; - - default: - throw new UnsupportedOperationException( - "Cannot update URL: " + url); - } - - String where = addIdToWhereClause(changedItemId, userWhere); - return db.update(sFeedsTable, values, where, whereArgs); - } - - private static String addIdToWhereClause(String id, String where) { - if (id != null) { - StringBuilder whereSb = new StringBuilder("_id="); - whereSb.append(id); - if (!TextUtils.isEmpty(where)) { - whereSb.append(" AND ("); - whereSb.append(where); - whereSb.append(')'); - } - return whereSb.toString(); - } else { - return where; - } - } - - private class FeedMerger extends AbstractTableMerger { - private ContentValues mValues = new ContentValues(); - FeedMerger() { - super(getDatabase(), sFeedsTable, sFeedsUrl, sDeletedFeedsTable, sDeletedFeedsUrl); - } - - @Override - protected void notifyChanges() { - getContext().getContentResolver().notifyChange( - sFeedsUrl, null /* data change observer */, - false /* do not sync to network */); - } - - @Override - public void insertRow(ContentProvider diffs, Cursor diffsCursor) { - final SQLiteDatabase db = getDatabase(); - // We don't ever want to add entries from the server, instead - // we want to tell the server to delete any entries we receive - // from the server that aren't already known by the client. - mValues.clear(); - DatabaseUtils.cursorStringToContentValues(diffsCursor, - SubscribedFeeds.Feeds._SYNC_ID, mValues); - DatabaseUtils.cursorStringToContentValues(diffsCursor, - SubscribedFeeds.Feeds._SYNC_ACCOUNT, mValues); - DatabaseUtils.cursorStringToContentValues(diffsCursor, - SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE, mValues); - DatabaseUtils.cursorStringToContentValues(diffsCursor, - SubscribedFeeds.Feeds._SYNC_VERSION, mValues); - db.replace(mDeletedTable, SubscribedFeeds.Feeds._SYNC_ID, mValues); - } - - @Override - public void updateRow(long localPersonID, ContentProvider diffs, - Cursor diffsCursor) { - updateOrResolveRow(localPersonID, null, diffs, diffsCursor, false); - } - - @Override - public void resolveRow(long localPersonID, String syncID, - ContentProvider diffs, Cursor diffsCursor) { - updateOrResolveRow(localPersonID, syncID, diffs, diffsCursor, true); - } - - protected void updateOrResolveRow(long localPersonID, String syncID, - ContentProvider diffs, Cursor diffsCursor, boolean conflicts) { - mValues.clear(); - // only copy over the fields that the server owns - DatabaseUtils.cursorStringToContentValues(diffsCursor, - SubscribedFeeds.Feeds._SYNC_ID, mValues); - DatabaseUtils.cursorStringToContentValues(diffsCursor, - SubscribedFeeds.Feeds._SYNC_TIME, mValues); - DatabaseUtils.cursorStringToContentValues(diffsCursor, - SubscribedFeeds.Feeds._SYNC_VERSION, mValues); - mValues.put(SubscribedFeeds.Feeds._SYNC_DIRTY, conflicts ? 1 : 0); - final SQLiteDatabase db = getDatabase(); - db.update(mTable, mValues, - SubscribedFeeds.Feeds._ID + '=' + localPersonID, null); - } - - @Override - public void deleteRow(Cursor localCursor) { - // Since the client is the authority we don't actually delete - // the row when the server says it has been deleted. Instead - // we break the association with the server by clearing out - // the id, time, and version, then we mark it dirty so that - // it will be synced back to the server. - long localPersonId = localCursor.getLong(localCursor.getColumnIndex( - SubscribedFeeds.Feeds._ID)); - mValues.clear(); - mValues.put(SubscribedFeeds.Feeds._SYNC_DIRTY, 1); - mValues.put(SubscribedFeeds.Feeds._SYNC_ID, (String) null); - mValues.put(SubscribedFeeds.Feeds._SYNC_TIME, (Long) null); - mValues.put(SubscribedFeeds.Feeds._SYNC_VERSION, (String) null); - final SQLiteDatabase db = getDatabase(); - db.update(mTable, mValues, SubscribedFeeds.Feeds._ID + '=' + localPersonId, null); - localCursor.moveToNext(); - } - } - - static { - Map map; - - map = new HashMap(); - ACCOUNTS_PROJECTION_MAP = map; - map.put(SubscribedFeeds.Accounts._COUNT, "COUNT(*) AS _count"); - map.put(SubscribedFeeds.Accounts._SYNC_ACCOUNT, SubscribedFeeds.Accounts._SYNC_ACCOUNT); - map.put(SubscribedFeeds.Accounts._SYNC_ACCOUNT_TYPE, - SubscribedFeeds.Accounts._SYNC_ACCOUNT_TYPE); - } -}