Merge change 7783 into donut
* changes:
Add "nodpi" density, and expose a bunch of density-related APIs.
diff --git a/core/java/android/appwidget/AppWidgetProvider.java b/core/java/android/appwidget/AppWidgetProvider.java
index 26712a1..f1bbede 100755
--- a/core/java/android/appwidget/AppWidgetProvider.java
+++ b/core/java/android/appwidget/AppWidgetProvider.java
@@ -64,11 +64,9 @@
}
else if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) {
Bundle extras = intent.getExtras();
- if (extras != null) {
- int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
- if (appWidgetIds != null && appWidgetIds.length > 0) {
- this.onDeleted(context, appWidgetIds);
- }
+ if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
+ final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
+ this.onDeleted(context, new int[] { appWidgetId });
}
}
else if (AppWidgetManager.ACTION_APPWIDGET_ENABLED.equals(action)) {
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index ff1eb53..28c1fe1fe 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -17,7 +17,6 @@
package android.view;
import android.content.Context;
-import android.content.res.CompatibilityInfo;
import android.content.res.CompatibilityInfo.Translator;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
@@ -256,7 +255,7 @@
public boolean dispatchTouchEvent(MotionEvent event) {
// SurfaceView uses pre-scaled size unless fixed size is requested. This hook
// scales the event back to the pre-scaled coordinates for such surface.
- if (mRequestedWidth < 0 && mTranslator != null) {
+ if (mScaled) {
MotionEvent scaledBack = MotionEvent.obtain(event);
scaledBack.scale(mTranslator.applicationScale);
try {
@@ -290,6 +289,8 @@
public void setWindowType(int type) {
mWindowType = type;
}
+
+ boolean mScaled = false;
private void updateWindow(boolean force) {
if (!mHaveFrame) {
@@ -309,6 +310,9 @@
if (mRequestedWidth <= 0 && mTranslator != null) {
myWidth *= appScale;
myHeight *= appScale;
+ mScaled = true;
+ } else {
+ mScaled = false;
}
getLocationInWindow(mLocation);
@@ -533,6 +537,7 @@
private SurfaceHolder mSurfaceHolder = new SurfaceHolder() {
private static final String LOG_TAG = "SurfaceHolder";
+ private int mSaveCount;
public boolean isCreating() {
return mIsCreating;
@@ -627,6 +632,10 @@
if (localLOGV) Log.i(TAG, "Returned canvas: " + c);
if (c != null) {
mLastLockTime = SystemClock.uptimeMillis();
+ if (mScaled) {
+ mSaveCount = c.save();
+ mTranslator.translateCanvas(c);
+ }
return c;
}
@@ -649,6 +658,9 @@
}
public void unlockCanvasAndPost(Canvas canvas) {
+ if (mScaled) {
+ canvas.restoreToCount(mSaveCount);
+ }
mSurface.unlockCanvasAndPost(canvas);
mSurfaceLock.unlock();
}
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp
index e71e348..44a9e8c 100644
--- a/core/jni/android_media_AudioRecord.cpp
+++ b/core/jni/android_media_AudioRecord.cpp
@@ -212,8 +212,10 @@
// failure:
native_init_failure:
+ env->DeleteGlobalRef(lpCallbackData->audioRecord_class);
+ env->DeleteGlobalRef(lpCallbackData->audioRecord_ref);
delete lpCallbackData;
-
+
native_track_failure:
delete lpRecorder;
@@ -274,6 +276,8 @@
thiz, javaAudioRecordFields.nativeCallbackCookie);
if (lpCookie) {
LOGV("deleting lpCookie: %x\n", (int)lpCookie);
+ env->DeleteGlobalRef(lpCookie->audioRecord_class);
+ env->DeleteGlobalRef(lpCookie->audioRecord_ref);
delete lpCookie;
}
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
index 39bbf16..ba46197 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
@@ -73,6 +73,10 @@
runTestAndWaitUntilDone(activity, runner.mTestPath, runner.mTimeoutInMillis);
activity.clearCache();
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ }
dumpMemoryInfo();
// Kill activity