OSDN Git Service

change to use the new CALLER_IS_SYNCADAPTER flag
authorFred Quintana <fredq@google.com>
Tue, 15 Sep 2009 00:31:26 +0000 (17:31 -0700)
committerFred Quintana <fredq@google.com>
Tue, 15 Sep 2009 03:55:43 +0000 (20:55 -0700)
core/java/android/accounts/AccountManagerService.java
core/java/android/provider/ContactsContract.java
core/res/res/values/strings.xml

index 6abed93..c13893a 100644 (file)
@@ -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);
index d354ccf..b0ac7f4 100644 (file)
@@ -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.
          * <P>Type: INTEGER</P>
          */
         public static final String DELETED = "deleted";
@@ -517,14 +527,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.
          */
         public static final int AGGREGATION_MODE_DEFAULT = 0;
@@ -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.
          * <P>Type: INTEGER</P>
          */
         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";
     }
 
     /**
index 0902c21..69ddd63 100644 (file)
     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). -->
-    <string name="notification_title">Sign-in error</string>
+    <string name="notification_title">Sign-in error for <xliff:g id="account" example="foo@gmail.com">%1$s</xliff:g></string>
 
     <!-- Sync notifications --> <skip />
     <!-- A notification is shown when there is a sync error.  This is the text that will scroll through the notification bar (will be seen by the user as he uses another application). -->