Merge change Ic9568e39 into eclair
* changes:
When tasks are moved to top or bottom, the app tokens are being rearranged. The window token rearrangement is defered if an animation is underway. Force a focus recomputation when the window tokens are finally rearranged so that we have a valid focused window.
diff --git a/api/current.xml b/api/current.xml
index a305fd1..2cda5bd 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -24703,6 +24703,208 @@
</parameter>
</method>
</interface>
+<class name="WallpaperInfo"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<implements name="android.os.Parcelable">
+</implements>
+<constructor name="WallpaperInfo"
+ type="android.app.WallpaperInfo"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="service" type="android.content.pm.ResolveInfo">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+<exception name="XmlPullParserException" type="org.xmlpull.v1.XmlPullParserException">
+</exception>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="dump"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pw" type="android.util.Printer">
+</parameter>
+<parameter name="prefix" type="java.lang.String">
+</parameter>
+</method>
+<method name="getComponent"
+ return="android.content.ComponentName"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getPackageName"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getServiceInfo"
+ return="android.content.pm.ServiceInfo"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getServiceName"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSettingsActivity"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="loadAuthor"
+ return="java.lang.CharSequence"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pm" type="android.content.pm.PackageManager">
+</parameter>
+<exception name="Resources.NotFoundException" type="android.content.res.Resources.NotFoundException">
+</exception>
+</method>
+<method name="loadDescription"
+ return="java.lang.CharSequence"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pm" type="android.content.pm.PackageManager">
+</parameter>
+<exception name="Resources.NotFoundException" type="android.content.res.Resources.NotFoundException">
+</exception>
+</method>
+<method name="loadIcon"
+ return="android.graphics.drawable.Drawable"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pm" type="android.content.pm.PackageManager">
+</parameter>
+</method>
+<method name="loadLabel"
+ return="java.lang.CharSequence"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pm" type="android.content.pm.PackageManager">
+</parameter>
+</method>
+<method name="loadThumbnail"
+ return="android.graphics.drawable.Drawable"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pm" type="android.content.pm.PackageManager">
+</parameter>
+</method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
+<field name="CREATOR"
+ type="android.os.Parcelable.Creator"
+ transient="false"
+ volatile="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
<class name="WallpaperManager"
extends="java.lang.Object"
abstract="false"
@@ -24794,6 +24996,17 @@
<parameter name="context" type="android.content.Context">
</parameter>
</method>
+<method name="getWallpaperInfo"
+ return="android.app.WallpaperInfo"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="peekDrawable"
return="android.graphics.drawable.Drawable"
abstract="false"
@@ -24916,6 +25129,17 @@
<parameter name="minimumHeight" type="int">
</parameter>
</method>
+<field name="ACTION_LIVE_WALLPAPER_CHOOSER"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.service.wallpaper.LIVE_WALLPAPER_CHOOSER""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
</package>
<package name="android.appwidget"
@@ -123228,6 +123452,309 @@
</implements>
</interface>
</package>
+<package name="android.service.wallpaper"
+>
+<class name="WallpaperService"
+ extends="android.app.Service"
+ abstract="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="WallpaperService"
+ type="android.service.wallpaper.WallpaperService"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="onBind"
+ return="android.os.IBinder"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="intent" type="android.content.Intent">
+</parameter>
+</method>
+<method name="onCreateEngine"
+ return="android.service.wallpaper.WallpaperService.Engine"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<field name="SERVICE_INTERFACE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.service.wallpaper.WallpaperService""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SERVICE_META_DATA"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.service.wallpaper""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<class name="WallpaperService.Engine"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="WallpaperService.Engine"
+ type="android.service.wallpaper.WallpaperService.Engine"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="getDesiredMinimumHeight"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getDesiredMinimumWidth"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSurfaceHolder"
+ return="android.view.SurfaceHolder"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isPreview"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isVisible"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="onCommand"
+ return="android.os.Bundle"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="action" type="java.lang.String">
+</parameter>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="z" type="int">
+</parameter>
+<parameter name="extras" type="android.os.Bundle">
+</parameter>
+<parameter name="resultRequested" type="boolean">
+</parameter>
+</method>
+<method name="onCreate"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="surfaceHolder" type="android.view.SurfaceHolder">
+</parameter>
+</method>
+<method name="onDesiredSizeChanged"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="desiredWidth" type="int">
+</parameter>
+<parameter name="desiredHeight" type="int">
+</parameter>
+</method>
+<method name="onDestroy"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="onOffsetsChanged"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="xOffset" type="float">
+</parameter>
+<parameter name="yOffset" type="float">
+</parameter>
+<parameter name="xPixelOffset" type="int">
+</parameter>
+<parameter name="yPixelOffset" type="int">
+</parameter>
+</method>
+<method name="onSurfaceChanged"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="holder" type="android.view.SurfaceHolder">
+</parameter>
+<parameter name="format" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+</method>
+<method name="onSurfaceCreated"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="holder" type="android.view.SurfaceHolder">
+</parameter>
+</method>
+<method name="onSurfaceDestroyed"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="holder" type="android.view.SurfaceHolder">
+</parameter>
+</method>
+<method name="onTouchEvent"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="event" type="android.view.MotionEvent">
+</parameter>
+</method>
+<method name="onVisibilityChanged"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="visible" type="boolean">
+</parameter>
+</method>
+<method name="setTouchEventsEnabled"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="enabled" type="boolean">
+</parameter>
+</method>
+</class>
+</package>
<package name="android.speech"
>
<class name="RecognizerIntent"
diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java
index 59d58aa..34d3133 100644
--- a/core/java/android/app/WallpaperInfo.java
+++ b/core/java/android/app/WallpaperInfo.java
@@ -5,7 +5,6 @@
import android.content.ComponentName;
import android.content.Context;
-import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
@@ -24,7 +23,6 @@
/**
* This class is used to specify meta information of a wallpaper service.
- * @hide Live Wallpaper
*/
public final class WallpaperInfo implements Parcelable {
static final String TAG = "WallpaperInfo";
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index 5881694..66a3396 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -57,7 +57,6 @@
/**
* Launch an activity for the user to pick the current global live
* wallpaper.
- * @hide Live Wallpaper
*/
public static final String ACTION_LIVE_WALLPAPER_CHOOSER
= "android.service.wallpaper.LIVE_WALLPAPER_CHOOSER";
@@ -395,7 +394,6 @@
* If the current wallpaper is a live wallpaper component, return the
* information about that wallpaper. Otherwise, if it is a static image,
* simply return null.
- * @hide Live Wallpaper
*/
public WallpaperInfo getWallpaperInfo() {
try {
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index dfd6af9..573be1e 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -47,7 +47,6 @@
/**
* A wallpaper service is responsible for showing a live wallpaper behind
* applications that would like to sit on top of it.
- * @hide Live Wallpaper
*/
public abstract class WallpaperService extends Service {
/**
@@ -366,7 +365,7 @@
/**
* Process a command that was sent to the wallpaper with
- * {@link WallpaperManager#sendWallpaperCommand(String, int, int, int, Bundle)}.
+ * {@link WallpaperManager#sendWallpaperCommand}.
* The default implementation does nothing, and always returns null
* as the result.
*
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 7e6258e..81da739 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -3474,8 +3474,7 @@
referenced from its
{@link android.service.wallpaper.WallpaperService#SERVICE_META_DATA}
meta-data entry. Described here are the attributes that can be
- included in that tag.
- @hide Live Wallpaper -->
+ included in that tag. -->
<declare-styleable name="Wallpaper">
<!-- Component name of an activity that allows the user to modify
the current settings for this wallpaper. -->
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index 695d061..952eff2 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -145,6 +145,7 @@
*
*/
public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback {
+ private final static boolean LOG_THREADS = false;
/**
* The renderer only renders
* when the surface is created, or when {@link #requestRender} is called.
@@ -952,11 +953,15 @@
mRequestRender = true;
mRenderMode = RENDERMODE_CONTINUOUSLY;
mRenderer = renderer;
- setName("GLThread");
}
@Override
public void run() {
+ setName("GLThread " + getId());
+ if (LOG_THREADS) {
+ Log.i("GLThread", "starting tid=" + getId());
+ }
+
/*
* When the android framework launches a second instance of
* an activity, the new instance's onCreate() method may be
@@ -967,7 +972,7 @@
*/
try {
try {
- sEglSemaphore.acquire();
+ sGLThreadManager.start(this);
} catch (InterruptedException e) {
return;
}
@@ -975,7 +980,17 @@
} catch (InterruptedException e) {
// fall thru and exit normally
} finally {
- sEglSemaphore.release();
+ try {
+ sGLThreadManager.end(this);
+ } finally {
+ synchronized(this) {
+ if (LOG_THREADS) {
+ Log.i("GLThread", "exiting tid=" + getId());
+ }
+ mDone = true;
+ notifyAll();
+ }
+ }
}
}
@@ -1011,11 +1026,14 @@
needStart = true;
}
while (needToWait()) {
+ if (LOG_THREADS) {
+ Log.i("GLThread", "needToWait tid=" + getId());
+ }
if (!mHasSurface) {
if (!mWaitingForSurface) {
mEglHelper.destroySurface();
mWaitingForSurface = true;
- notify();
+ notifyAll();
}
}
wait();
@@ -1031,6 +1049,7 @@
if (mHasSurface && mWaitingForSurface) {
changed = true;
mWaitingForSurface = false;
+ notifyAll();
}
}
if (needStart) {
@@ -1071,6 +1090,10 @@
}
private boolean needToWait() {
+ if (sGLThreadManager.shouldQuit(this)) {
+ mDone = true;
+ notifyAll();
+ }
if (mDone) {
return false;
}
@@ -1093,7 +1116,7 @@
synchronized(this) {
mRenderMode = renderMode;
if (renderMode == RENDERMODE_CONTINUOUSLY) {
- notify();
+ notifyAll();
}
}
}
@@ -1107,22 +1130,28 @@
public void requestRender() {
synchronized(this) {
mRequestRender = true;
- notify();
+ notifyAll();
}
}
public void surfaceCreated() {
synchronized(this) {
+ if (LOG_THREADS) {
+ Log.i("GLThread", "surfaceCreated tid=" + getId());
+ }
mHasSurface = true;
- notify();
+ notifyAll();
}
}
public void surfaceDestroyed() {
synchronized(this) {
+ if (LOG_THREADS) {
+ Log.i("GLThread", "surfaceDestroyed tid=" + getId());
+ }
mHasSurface = false;
- notify();
- while(!mWaitingForSurface && isAlive()) {
+ notifyAll();
+ while(!mWaitingForSurface && isAlive() && ! mDone) {
try {
wait();
} catch (InterruptedException e) {
@@ -1135,13 +1164,15 @@
public void onPause() {
synchronized (this) {
mPaused = true;
+ notifyAll();
}
}
public void onResume() {
synchronized (this) {
mPaused = false;
- notify();
+ mRequestRender = true;
+ notifyAll();
}
}
@@ -1150,7 +1181,7 @@
mWidth = w;
mHeight = h;
mSizeChanged = true;
- notify();
+ notifyAll();
}
}
@@ -1159,7 +1190,7 @@
// deadlock!
synchronized(this) {
mDone = true;
- notify();
+ notifyAll();
}
try {
join();
@@ -1241,7 +1272,38 @@
}
}
+ static class GLThreadManager {
+ public boolean shouldQuit(GLThread thread) {
+ synchronized(this) {
+ return thread != mMostRecentGLThread;
+ }
+ }
+ public void start(GLThread thread) throws InterruptedException {
+ GLThread oldThread = null;
+ synchronized(this) {
+ mMostRecentGLThread = thread;
+ oldThread = mMostRecentGLThread;
+ }
+ if (oldThread != null) {
+ synchronized(oldThread) {
+ oldThread.notifyAll();
+ }
+ }
+ sEglSemaphore.acquire();
+ }
+ public void end(GLThread thread) {
+ sEglSemaphore.release();
+ synchronized(this) {
+ if (mMostRecentGLThread == thread) {
+ mMostRecentGLThread = null;
+ }
+ }
+ }
+ private GLThread mMostRecentGLThread;
+ }
+
private static final Semaphore sEglSemaphore = new Semaphore(1);
+ private static final GLThreadManager sGLThreadManager = new GLThreadManager();
private boolean mSizeChanged = true;
private GLThread mGLThread;
diff --git a/tests/StatusBar/AndroidManifest.xml b/tests/StatusBar/AndroidManifest.xml
index 9bba79c..21fb951 100644
--- a/tests/StatusBar/AndroidManifest.xml
+++ b/tests/StatusBar/AndroidManifest.xml
@@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.statusbartest">
<uses-permission android:name="android.permission.DEVICE_POWER" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.STATUS_BAR" />
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
<uses-permission android:name="android.permission.VIBRATE" />
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
index a88183c..f2ddd0f 100644
--- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
+++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
@@ -58,6 +58,27 @@
}
private Test[] mTests = new Test[] {
+ new Test("Off and sound") {
+ public void run() {
+ PowerManager pm = (PowerManager)NotificationTestList.this.getSystemService("power");
+ PowerManager.WakeLock wl =
+ pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "sound");
+ wl.acquire();
+
+ pm.goToSleep(SystemClock.uptimeMillis());
+
+ Notification n = new Notification();
+ n.sound = Uri.parse("file:///sdcard/virtual-void.mp3");
+ Log.d(TAG, "n.sound=" + n.sound);
+
+ mNM.notify(1, n);
+
+ Log.d(TAG, "releasing wake lock");
+ wl.release();
+ Log.d(TAG, "released wake lock");
+ }
+ },
+
new Test("No view") {
public void run() {
Notification n = new Notification(R.drawable.icon1, "No view",