diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/content/ContentResolver.java | 4 | ||||
-rw-r--r-- | core/java/android/os/Message.java | 25 | ||||
-rw-r--r-- | core/java/android/service/wallpaper/WallpaperService.java | 7 | ||||
-rw-r--r-- | core/java/android/view/LayoutInflater.java | 2 | ||||
-rw-r--r-- | core/java/android/view/WindowManager.java | 8 | ||||
-rw-r--r-- | core/tests/coretests/src/android/content/ContentResolverTest.java | 41 |
6 files changed, 63 insertions, 24 deletions
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index da518c2..2d03e7c 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -1579,9 +1579,11 @@ public abstract class ContentResolver { @Override protected void finalize() throws Throwable { + // TODO: integrate CloseGuard support. try { if(!mCloseFlag) { - ContentResolver.this.releaseProvider(mContentProvider); + Log.w(TAG, "Cursor finalized without prior close()"); + close(); } } finally { super.finalize(); diff --git a/core/java/android/os/Message.java b/core/java/android/os/Message.java index eb941e4..557e53f 100644 --- a/core/java/android/os/Message.java +++ b/core/java/android/os/Message.java @@ -96,9 +96,9 @@ public final class Message implements Parcelable { // sometimes we store linked lists of these things /*package*/ Message next; - private static Object mPoolSync = new Object(); - private static Message mPool; - private static int mPoolSize = 0; + private static final Object sPoolSync = new Object(); + private static Message sPool; + private static int sPoolSize = 0; private static final int MAX_POOL_SIZE = 10; @@ -107,11 +107,12 @@ public final class Message implements Parcelable { * avoid allocating new objects in many cases. */ public static Message obtain() { - synchronized (mPoolSync) { - if (mPool != null) { - Message m = mPool; - mPool = m.next; + synchronized (sPoolSync) { + if (sPool != null) { + Message m = sPool; + sPool = m.next; m.next = null; + sPoolSize--; return m; } } @@ -248,12 +249,12 @@ public final class Message implements Parcelable { * freed. */ public void recycle() { - synchronized (mPoolSync) { - if (mPoolSize < MAX_POOL_SIZE) { + synchronized (sPoolSync) { + if (sPoolSize < MAX_POOL_SIZE) { clearForRecycle(); - - next = mPool; - mPool = this; + next = sPool; + sPool = this; + sPoolSize++; } } } diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 44887ed..95d985d 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -517,8 +517,11 @@ public abstract class WallpaperService extends Service { mLayout.windowAnimations = com.android.internal.R.style.Animation_Wallpaper; mInputChannel = new InputChannel(); - mSession.add(mWindow, mLayout, View.VISIBLE, mContentInsets, - mInputChannel); + if (mSession.add(mWindow, mLayout, View.VISIBLE, mContentInsets, + mInputChannel) < 0) { + Log.w(TAG, "Failed to add window while updating wallpaper surface."); + return; + } mCreated = true; InputQueue.registerInputChannel(mInputChannel, mInputHandler, diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java index a17ed9d..81346b4 100644 --- a/core/java/android/view/LayoutInflater.java +++ b/core/java/android/view/LayoutInflater.java @@ -38,7 +38,7 @@ import java.util.HashMap; * for the device you are running on. For example: * * <pre>LayoutInflater inflater = (LayoutInflater)context.getSystemService - * Context.LAYOUT_INFLATER_SERVICE);</pre> + * (Context.LAYOUT_INFLATER_SERVICE);</pre> * * <p> * To create a new LayoutInflater with an additional {@link Factory} for your diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index c26fa93..02e5b63 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1171,14 +1171,6 @@ public interface WindowManager extends ViewManager { gravity = o.gravity; changes |= LAYOUT_CHANGED; } - if (horizontalMargin != o.horizontalMargin) { - horizontalMargin = o.horizontalMargin; - changes |= LAYOUT_CHANGED; - } - if (verticalMargin != o.verticalMargin) { - verticalMargin = o.verticalMargin; - changes |= LAYOUT_CHANGED; - } if (format != o.format) { format = o.format; changes |= FORMAT_CHANGED; diff --git a/core/tests/coretests/src/android/content/ContentResolverTest.java b/core/tests/coretests/src/android/content/ContentResolverTest.java new file mode 100644 index 0000000..2b6dee8 --- /dev/null +++ b/core/tests/coretests/src/android/content/ContentResolverTest.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 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 android.content; + +import android.content.ContentResolver; +import android.provider.ContactsContract; +import android.test.AndroidTestCase; +import android.test.suitebuilder.annotation.LargeTest; + +public class ContentResolverTest extends AndroidTestCase { + private ContentResolver mContentResolver; + + @Override + protected void setUp() throws Exception { + super.setUp(); + mContentResolver = mContext.getContentResolver(); + } + + @LargeTest + public void testCursorFinalizer() throws Exception { + // TODO: Want a test case that more predictably reproduce this issue. Selected + // 600 as this causes the problem 100% of the runs on current hw, it might not + // do so on some other configuration though. + for (int i = 0; i < 600; i++) { + mContentResolver.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); + } + } +} |