From 33f889ae270f888f8fdc084f5f1f3d443532a46a Mon Sep 17 00:00:00 2001 From: Fred Quintana Date: Mon, 14 Sep 2009 17:31:26 -0700 Subject: [PATCH] change to use the new CALLER_IS_SYNCADAPTER flag --- .../accounts/AccountManagerService.java | 9 +++- .../android/provider/ContactsContract.java | 46 ++++++------------- core/res/res/values/strings.xml | 2 +- 3 files changed, 22 insertions(+), 35 deletions(-) diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java index 6abed93e284e4..c13893a5a5743 100644 --- a/core/java/android/accounts/AccountManagerService.java +++ b/core/java/android/accounts/AccountManagerService.java @@ -1445,13 +1445,18 @@ public class AccountManagerService extends IAccountManager.Stub { intent.getComponent().getClassName())) { createNoCredentialsPermissionNotification(account, intent); } else { + final Integer notificationId = getSigninRequiredNotificationId(account); + intent.addCategory(String.valueOf(notificationId)); Notification n = new Notification(android.R.drawable.stat_sys_warning, null, 0 /* when */); - n.setLatestEventInfo(mContext, mContext.getText(R.string.notification_title), + final String notificationTitleFormat = + mContext.getText(R.string.notification_title).toString(); + n.setLatestEventInfo(mContext, + String.format(notificationTitleFormat, account.name), message, PendingIntent.getActivity( mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT)); ((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)) - .notify(getSigninRequiredNotificationId(account), n); + .notify(notificationId, n); } } finally { restoreCallingIdentity(identityToken); diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index d354ccffd8897..b0ac7f4b86089 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -46,6 +46,15 @@ public final class ContactsContract { /** A content:// style uri to the authority for the contacts provider */ public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY); + /** + * An optional insert, update or delete URI parameter that allows the caller + * to specify that it is a sync adapter. The default value is false. If true + * the dirty flag is not automatically set and the "syncToNetwork" parameter + * is set to false when calling + * {@link ContentResolver#notifyChange(android.net.Uri, android.database.ContentObserver, boolean)}. + */ + public static final String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter"; + public interface SyncStateColumns extends SyncStateContract.Columns { } @@ -480,7 +489,8 @@ public final class ContactsContract { * called on a raw contact, it is marked for deletion and removed from its * aggregate contact. The sync adaptor deletes the raw contact on the server and * then calls ContactResolver.delete once more, this time passing the - * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal. + * {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter to finalize + * the data removal. *

Type: INTEGER

*/ public static final String DELETED = "deleted"; @@ -516,14 +526,6 @@ public final class ContactsContract { */ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/raw_contact"; - /** - * Query parameter that can be passed with the {@link #CONTENT_URI} URI - * to the {@link android.content.ContentResolver#delete} method to - * indicate that the raw contact can be deleted physically, rather than - * merely marked as deleted. - */ - public static final String DELETE_PERMANENTLY = "delete_permanently"; - /** * Aggregation mode: aggregate asynchronously. */ @@ -648,13 +650,6 @@ public final class ContactsContract { public static final String SYNC3 = "data_sync3"; /** Generic column for use by sync adapters. */ public static final String SYNC4 = "data_sync4"; - - /** - * An optional insert, update or delete URI parameter that determines if - * the corresponding raw contact should be marked as dirty. The default - * value is true. - */ - public static final String MARK_AS_DIRTY = "mark_as_dirty"; } /** @@ -1533,8 +1528,9 @@ public final class ContactsContract { * for deletion. When {@link android.content.ContentResolver#delete} is * called on a raw contact, it is marked for deletion and removed from its * aggregate contact. The sync adaptor deletes the raw contact on the server and - * then calls ContactResolver.delete once more, this time passing the - * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal. + * then calls ContactResolver.delete once more, this time setting the the + * {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter to finalize + * the data removal. *

Type: INTEGER

*/ public static final String DELETED = "deleted"; @@ -1579,20 +1575,6 @@ public final class ContactsContract { * The MIME type of a single group. */ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group"; - - /** - * Query parameter that can be passed with the {@link #CONTENT_URI} URI - * to the {@link android.content.ContentResolver#delete} method to - * indicate that the raw contact can be deleted physically, rather than - * merely marked as deleted. - */ - public static final String DELETE_PERMANENTLY = "delete_permanently"; - - /** - * An optional update or insert URI parameter that determines if the - * group should be marked as dirty. The default value is true. - */ - public static final String MARK_AS_DIRTY = "mark_as_dirty"; } /** diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 0902c217a7fcd..69ddd630f0e97 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -234,7 +234,7 @@ supply an auth token without prompting the user to re-enter the password. This is the text that will scroll through the notification bar (will be seen by the user as he uses another application). --> - Sign-in error + Sign-in error for %1$s