diff options
| -rw-r--r-- | core/java/android/app/Activity.java | 4 | ||||
| -rw-r--r-- | core/java/android/content/Context.java | 2 | ||||
| -rw-r--r-- | core/java/android/pim/vcard/ContactStruct.java | 34 | ||||
| -rw-r--r-- | libs/surfaceflinger/Layer.cpp | 12 | 
4 files changed, 46 insertions, 6 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index f8fec6fdb692..a86fe909ec31 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -2861,7 +2861,7 @@ public class Activity extends ContextThemeWrapper      /**       * Like {@link #startActivity(Intent)}, but taking a IntentSender       * to start; see -     * {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int)} +     * {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int, int)}       * for more information.       *        * @param intent The IntentSender to launch. @@ -3003,7 +3003,7 @@ public class Activity extends ContextThemeWrapper      /**       * Like {@link #startActivityFromChild(Activity, Intent, int)}, but       * taking a IntentSender; see -     * {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int)} +     * {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int, int)}       * for more information.       */      public void startIntentSenderFromChild(Activity child, IntentSender intent, diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 1a5269e378d0..a3c4f9a28dd4 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -561,7 +561,7 @@ public abstract class Context {      /**       * Like {@link #startActivity(Intent)}, but taking a IntentSender       * to start.  If the IntentSender is for an activity, that activity will be started -     * as if you had called the regular {@link #startActivityForResult(Intent, int)} +     * as if you had called the regular {@link #startActivity(Intent)}       * here; otherwise, its associated action will be executed (such as       * sending a broadcast) as if you had called       * {@link IntentSender#sendIntent IntentSender.sendIntent} on it. diff --git a/core/java/android/pim/vcard/ContactStruct.java b/core/java/android/pim/vcard/ContactStruct.java index 06b06360c658..b212f5a3b814 100644 --- a/core/java/android/pim/vcard/ContactStruct.java +++ b/core/java/android/pim/vcard/ContactStruct.java @@ -20,11 +20,14 @@ import android.content.ContentProviderOperation;  import android.content.ContentResolver;  import android.content.ContentValues;  import android.content.OperationApplicationException; +import android.database.Cursor;  import android.os.RemoteException;  import android.provider.ContactsContract;  import android.provider.ContactsContract.Data; +import android.provider.ContactsContract.Groups;  import android.provider.ContactsContract.RawContacts;  import android.provider.ContactsContract.CommonDataKinds.Email; +import android.provider.ContactsContract.CommonDataKinds.GroupMembership;  import android.provider.ContactsContract.CommonDataKinds.Im;  import android.provider.ContactsContract.CommonDataKinds.Miscellaneous;  import android.provider.ContactsContract.CommonDataKinds.Nickname; @@ -1023,14 +1026,37 @@ public class ContactStruct {          }      } +    // From HardCodedSources.java in Contacts app. +    // TODO: fix this. +    private static final String ACCOUNT_TYPE_GOOGLE = "com.google.GAIA"; +    private static final String GOOGLE_MY_CONTACTS_GROUP = "System Group: My Contacts"; +      public void pushIntoContentResolver(ContentResolver resolver) {          ArrayList<ContentProviderOperation> operationList =              new ArrayList<ContentProviderOperation>();            ContentProviderOperation.Builder builder =              ContentProviderOperation.newInsert(RawContacts.CONTENT_URI); +        String myGroupsId = null;          if (mAccount != null) {              builder.withValue(RawContacts.ACCOUNT_NAME, mAccount.name);              builder.withValue(RawContacts.ACCOUNT_TYPE, mAccount.type); + +            // TODO: temporal fix for "My Groups" issue. Need to be refactored. +            if (ACCOUNT_TYPE_GOOGLE.equals(mAccount.type)) { +                final Cursor cursor = resolver.query(Groups.CONTENT_URI, new String[] { +                        Groups.SOURCE_ID }, +                        Groups.TITLE + "=?", new String[] { +                        GOOGLE_MY_CONTACTS_GROUP }, null); +                try { +                    if (cursor != null && cursor.moveToFirst()) { +                        myGroupsId = cursor.getString(0); +                    } +                } finally { +                    if (cursor != null) { +                        cursor.close(); +                    } +                } +            }          } else {              builder.withValues(new ContentValues());          } @@ -1196,6 +1222,14 @@ public class ContactStruct {              operationList.add(builder.build());          } +        if (myGroupsId != null) { +            builder = ContentProviderOperation.newInsert(Data.CONTENT_URI); +            builder.withValueBackReference(GroupMembership.RAW_CONTACT_ID, 0); +            builder.withValue(Data.MIMETYPE, GroupMembership.CONTENT_ITEM_TYPE); +            builder.withValue(GroupMembership.GROUP_SOURCE_ID, myGroupsId); +            operationList.add(builder.build()); +        } +          try {              resolver.applyBatch(ContactsContract.AUTHORITY, operationList);          } catch (RemoteException e) { diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index 7387c852af6c..8dfc2cf766b9 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -176,7 +176,7 @@ void Layer::reloadTexture(const Region& dirty)                      // this failed, for instance, because we don't support                      // NPOT.                      // FIXME: do something! -                    LOGD("layer=%p, glEGLImageTargetTexture2DOES(%d) " +                    LOGD("layer=%p, glEGLImageTargetTexture2DOES(%p) "                           "failed err=0x%04x",                           this, mTextures[index].image, error);                      mFlags &= ~DisplayHardware::DIRECT_TEXTURE; @@ -256,11 +256,17 @@ sp<SurfaceBuffer> Layer::requestBuffer(int index, int usage)          w = mWidth;          h = mHeight;          buffer = mBuffers[index]; +         +        // destroy() could have been called before we get here, we log it +        // because it's uncommon, and the code below should handle it +        LOGW_IF(buffer==0,  +                "mBuffers[%d] is null (mWidth=%d, mHeight=%d)", +                index, w, h); +                  mBuffers[index].clear();      } - -    if (buffer->getStrongCount() == 1) { +    if (buffer!=0 && buffer->getStrongCount() == 1) {          err = buffer->reallocate(w, h, mFormat, usage, mBufferFlags);      } else {          // here we have to reallocate a new buffer because we could have a  |