diff options
32 files changed, 619 insertions, 201 deletions
diff --git a/api/current.xml b/api/current.xml index fa9ab93..d6b272f 100644 --- a/api/current.xml +++ b/api/current.xml @@ -17060,6 +17060,27 @@ <parameter name="id" type="int"> </parameter> </method> +<method name="startActivity" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="intent" type="android.app.PendingIntent"> +</parameter> +<parameter name="fillInIntent" type="android.content.Intent"> +</parameter> +<parameter name="flagsMask" type="int"> +</parameter> +<parameter name="flagsValues" type="int"> +</parameter> +<exception name="PendingIntent.CanceledException" type="android.app.PendingIntent.CanceledException"> +</exception> +</method> <method name="startActivityForResult" return="void" abstract="false" @@ -17075,6 +17096,29 @@ <parameter name="requestCode" type="int"> </parameter> </method> +<method name="startActivityForResult" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="intent" type="android.app.PendingIntent"> +</parameter> +<parameter name="requestCode" type="int"> +</parameter> +<parameter name="fillInIntent" type="android.content.Intent"> +</parameter> +<parameter name="flagsMask" type="int"> +</parameter> +<parameter name="flagsValues" type="int"> +</parameter> +<exception name="PendingIntent.CanceledException" type="android.app.PendingIntent.CanceledException"> +</exception> +</method> <method name="startActivityFromChild" return="void" abstract="false" @@ -17092,6 +17136,31 @@ <parameter name="requestCode" type="int"> </parameter> </method> +<method name="startActivityFromChild" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="child" type="android.app.Activity"> +</parameter> +<parameter name="intent" type="android.app.PendingIntent"> +</parameter> +<parameter name="requestCode" type="int"> +</parameter> +<parameter name="fillInIntent" type="android.content.Intent"> +</parameter> +<parameter name="flagsMask" type="int"> +</parameter> +<parameter name="flagsValues" type="int"> +</parameter> +<exception name="PendingIntent.CanceledException" type="android.app.PendingIntent.CanceledException"> +</exception> +</method> <method name="startActivityIfNeeded" return="boolean" abstract="false" diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 80d7285..8c10091 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -2649,10 +2649,8 @@ public class Activity extends ContextThemeWrapper } @Override - protected void onApplyThemeResource(Resources.Theme theme, - int resid, - boolean first) - { + protected void onApplyThemeResource(Resources.Theme theme, int resid, + boolean first) { if (mParent == null) { super.onApplyThemeResource(theme, resid, first); } else { @@ -2723,6 +2721,66 @@ public class Activity extends ContextThemeWrapper } /** + * Like {@link #startActivityForResult(Intent, int)}, but allowing you + * to use a PendingIntent to describe the activity to be started. Note + * that the given PendingIntent <em>must</em> have been created with + * {@link PendingIntent#getActivity PendingIntent.getActivity}; all other + * types will result in an IllegalArgumentException being thrown. + * + * @param intent The PendingIntent to launch. + * @param requestCode If >= 0, this code will be returned in + * onActivityResult() when the activity exits. + * @param fillInIntent If non-null, this will be provided as the + * intent parameter to {@link PendingIntent#send(Context, int, Intent) + * PendingIntent.send(Context, int, Intent)}. + * @param flagsMask Intent flags in the original PendingIntent that you + * would like to change. + * @param flagsValues Desired values for any bits set in + * <var>flagsMask</var> + */ + public void startActivityForResult(PendingIntent intent, int requestCode, + Intent fillInIntent, int flagsMask, int flagsValues) + throws PendingIntent.CanceledException { + if (mParent == null) { + startActivityForResultInner(intent, requestCode, fillInIntent, + flagsMask, flagsValues, this); + } else { + mParent.startActivityFromChild(this, intent, requestCode, + fillInIntent, flagsMask, flagsValues); + } + } + + private void startActivityForResultInner(PendingIntent intent, int requestCode, + Intent fillInIntent, int flagsMask, int flagsValues, Activity activity) + throws PendingIntent.CanceledException { + try { + String resolvedType = null; + if (fillInIntent != null) { + resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver()); + } + int result = ActivityManagerNative.getDefault() + .startActivityPendingIntent(mMainThread.getApplicationThread(), intent, + fillInIntent, resolvedType, mToken, activity.mEmbeddedID, + requestCode, flagsMask, flagsValues); + if (result == IActivityManager.START_CANCELED) { + throw new PendingIntent.CanceledException(); + } + Instrumentation.checkStartActivityResult(result, null); + } catch (RemoteException e) { + } + if (requestCode >= 0) { + // If this start is requesting a result, we can avoid making + // the activity visible until the result is received. Setting + // this code during onCreate(Bundle savedInstanceState) or onResume() will keep the + // activity hidden during this time, to avoid flickering. + // This can only be done when a result is requested because + // that guarantees we will get information back when the + // activity is finished, no matter what happens to it. + mStartedActivity = true; + } + } + + /** * Launch a new activity. You will not receive any information about when * the activity exits. This implementation overrides the base version, * providing information about @@ -2746,6 +2804,27 @@ public class Activity extends ContextThemeWrapper } /** + * Like {@link #startActivity(Intent)}, but taking a PendingIntent + * to start; see + * {@link #startActivityForResult(PendingIntent, int, Intent, int, int)} + * for more information. + * + * @param intent The PendingIntent to launch. + * @param fillInIntent If non-null, this will be provided as the + * intent parameter to {@link PendingIntent#send(Context, int, Intent) + * PendingIntent.send(Context, int, Intent)}. + * @param flagsMask Intent flags in the original PendingIntent that you + * would like to change. + * @param flagsValues Desired values for any bits set in + * <var>flagsMask</var> + */ + public void startActivity(PendingIntent intent, + Intent fillInIntent, int flagsMask, int flagsValues) + throws PendingIntent.CanceledException { + startActivityForResult(intent, -1, fillInIntent, flagsMask, flagsValues); + } + + /** * A special variation to launch an activity only if a new activity * instance is needed to handle the given Intent. In other words, this is * just like {@link #startActivityForResult(Intent, int)} except: if you are @@ -2866,6 +2945,19 @@ public class Activity extends ContextThemeWrapper } /** + * Like {@link #startActivityFromChild(Activity, Intent, int)}, but + * taking a PendingIntent; see + * {@link #startActivityForResult(PendingIntent, int, Intent, int, int)} + * for more information. + */ + public void startActivityFromChild(Activity child, PendingIntent intent, + int requestCode, Intent fillInIntent, int flagsMask, int flagsValues) + throws PendingIntent.CanceledException { + startActivityForResultInner(intent, requestCode, fillInIntent, + flagsMask, flagsValues, child); + } + + /** * Call this to set the result that your activity will return to its * caller. * diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 4ed152e..4796e49 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -144,6 +144,30 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeInt(result); return true; } + + case START_ACTIVITY_PENDING_INTENT_TRANSACTION: + { + data.enforceInterface(IActivityManager.descriptor); + IBinder b = data.readStrongBinder(); + IApplicationThread app = ApplicationThreadNative.asInterface(b); + PendingIntent intent = PendingIntent.CREATOR.createFromParcel(data); + Intent fillInIntent = null; + if (data.readInt() != 0) { + fillInIntent = Intent.CREATOR.createFromParcel(data); + } + String resolvedType = data.readString(); + IBinder resultTo = data.readStrongBinder(); + String resultWho = data.readString(); + int requestCode = data.readInt(); + int flagsMask = data.readInt(); + int flagsValues = data.readInt(); + int result = startActivityPendingIntent(app, intent, + fillInIntent, resolvedType, resultTo, resultWho, + requestCode, flagsMask, flagsValues); + reply.writeNoException(); + reply.writeInt(result); + return true; + } case START_NEXT_MATCHING_ACTIVITY_TRANSACTION: { @@ -1179,6 +1203,34 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); return result; } + public int startActivityPendingIntent(IApplicationThread caller, + PendingIntent intent, Intent fillInIntent, String resolvedType, + IBinder resultTo, String resultWho, int requestCode, + int flagsMask, int flagsValues) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(caller != null ? caller.asBinder() : null); + intent.writeToParcel(data, 0); + if (fillInIntent != null) { + data.writeInt(1); + fillInIntent.writeToParcel(data, 0); + } else { + data.writeInt(0); + } + data.writeString(resolvedType); + data.writeStrongBinder(resultTo); + data.writeString(resultWho); + data.writeInt(requestCode); + data.writeInt(flagsMask); + data.writeInt(flagsValues); + mRemote.transact(START_ACTIVITY_PENDING_INTENT_TRANSACTION, data, reply, 0); + reply.readException(); + int result = reply.readInt(); + reply.recycle(); + data.recycle(); + return result; + } public boolean startNextMatchingActivity(IBinder callingActivity, Intent intent) throws RemoteException { Parcel data = Parcel.obtain(); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index a937c11..8244645 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -77,10 +77,16 @@ public interface IActivityManager extends IInterface { public static final int START_CLASS_NOT_FOUND = -2; public static final int START_FORWARD_AND_REQUEST_CONFLICT = -3; public static final int START_PERMISSION_DENIED = -4; + public static final int START_NOT_ACTIVITY = -5; + public static final int START_CANCELED = -6; public int startActivity(IApplicationThread caller, Intent intent, String resolvedType, Uri[] grantedUriPermissions, int grantedMode, IBinder resultTo, String resultWho, int requestCode, boolean onlyIfNeeded, boolean debug) throws RemoteException; + public int startActivityPendingIntent(IApplicationThread caller, + PendingIntent intent, Intent fillInIntent, String resolvedType, + IBinder resultTo, String resultWho, int requestCode, + int flagsMask, int flagsValues) throws RemoteException; public boolean startNextMatchingActivity(IBinder callingActivity, Intent intent) throws RemoteException; public boolean finishActivity(IBinder token, int code, Intent data) @@ -436,4 +442,5 @@ public interface IActivityManager extends IInterface { int CLOSE_SYSTEM_DIALOGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+96; int GET_PROCESS_MEMORY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+97; int KILL_APPLICATION_PROCESS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+98; + int START_ACTIVITY_PENDING_INTENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+99; } diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index e31f4f8..6d79aee 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -1468,7 +1468,7 @@ public class Instrumentation { mWatcher = watcher; } - /*package*/ static void checkStartActivityResult(int res, Intent intent) { + /*package*/ static void checkStartActivityResult(int res, Object intent) { if (res >= IActivityManager.START_SUCCESS) { return; } @@ -1476,10 +1476,10 @@ public class Instrumentation { switch (res) { case IActivityManager.START_INTENT_NOT_RESOLVED: case IActivityManager.START_CLASS_NOT_FOUND: - if (intent.getComponent() != null) + if (intent instanceof Intent && ((Intent)intent).getComponent() != null) throw new ActivityNotFoundException( "Unable to find explicit activity class " - + intent.getComponent().toShortString() + + ((Intent)intent).getComponent().toShortString() + "; have you declared this activity in your AndroidManifest.xml?"); throw new ActivityNotFoundException( "No Activity found to handle " + intent); @@ -1489,6 +1489,9 @@ public class Instrumentation { case IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT: throw new AndroidRuntimeException( "FORWARD_RESULT_FLAG used while also requesting a result"); + case IActivityManager.START_NOT_ACTIVITY: + throw new IllegalArgumentException( + "PendingIntent is not an activity"); default: throw new AndroidRuntimeException("Unknown error code " + res + " when starting " + intent); diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index f7479bc..18d9b92 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -519,7 +519,8 @@ public final class PendingIntent implements Parcelable { mTarget = IIntentSender.Stub.asInterface(target); } - /*package*/ IIntentSender getTarget() { + /** @hide */ + public IIntentSender getTarget() { return mTarget; } } diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 95b5730..e5659d5 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -22,7 +22,10 @@ import com.android.internal.view.BaseSurfaceHolder; import android.app.Service; import android.app.WallpaperManager; +import android.content.BroadcastReceiver; +import android.content.Context; import android.content.Intent; +import android.content.IntentFilter; import android.graphics.Rect; import android.os.IBinder; import android.os.Message; @@ -88,6 +91,8 @@ public abstract class WallpaperService extends Service { boolean mInitializing = true; boolean mVisible; + boolean mScreenOn = true; + boolean mReportedVisible; boolean mDestroyed; // Current window state. @@ -117,6 +122,19 @@ public abstract class WallpaperService extends Service { float mPendingYOffset; MotionEvent mPendingMove; + final BroadcastReceiver mReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (Intent.ACTION_SCREEN_ON.equals(intent.getAction())) { + mScreenOn = true; + reportVisibility(); + } else if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) { + mScreenOn = false; + reportVisibility(); + } + } + }; + final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() { @Override @@ -239,7 +257,7 @@ public abstract class WallpaperService extends Service { * {@link #onVisibilityChanged(boolean)}. */ public boolean isVisible() { - return mVisible; + return mReportedVisible; } /** @@ -489,6 +507,11 @@ public abstract class WallpaperService extends Service { mSession = ViewRoot.getWindowSession(getMainLooper()); mWindow.setSession(mSession); + IntentFilter filter = new IntentFilter(); + filter.addAction(Intent.ACTION_SCREEN_ON); + filter.addAction(Intent.ACTION_SCREEN_OFF); + registerReceiver(mReceiver, filter); + if (DEBUG) Log.v(TAG, "onCreate(): " + this); onCreate(mSurfaceHolder); @@ -505,11 +528,19 @@ public abstract class WallpaperService extends Service { } void doVisibilityChanged(boolean visible) { + mVisible = visible; + reportVisibility(); + } + + void reportVisibility() { if (!mDestroyed) { - mVisible = visible; - if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible - + "): " + this); - onVisibilityChanged(visible); + boolean visible = mVisible && mScreenOn; + if (mReportedVisible != visible) { + mReportedVisible = visible; + if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible + + "): " + this); + onVisibilityChanged(visible); + } } } @@ -562,6 +593,8 @@ public abstract class WallpaperService extends Service { if (DEBUG) Log.v(TAG, "onDestroy(): " + this); onDestroy(); + unregisterReceiver(mReceiver); + if (mCreated) { try { mSession.remove(mWindow); diff --git a/core/res/res/anim/activity_close_enter.xml b/core/res/res/anim/activity_close_enter.xml new file mode 100644 index 0000000..9d1ef53 --- /dev/null +++ b/core/res/res/anim/activity_close_enter.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, 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. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@anim/decelerate_interpolator" + android:zAdjustment="top"> + <translate android:fromXDelta="-100%" android:toXDelta="0" + android:duration="@android:integer/config_mediumAnimTime"/> +</set> diff --git a/core/res/res/anim/activity_close_exit.xml b/core/res/res/anim/activity_close_exit.xml new file mode 100644 index 0000000..47cb6d6 --- /dev/null +++ b/core/res/res/anim/activity_close_exit.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, 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. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@anim/decelerate_interpolator"> + <translate android:fromXDelta="0%" android:toXDelta="33%" + android:duration="@android:integer/config_mediumAnimTime"/> +</set> diff --git a/core/res/res/anim/activity_open_enter.xml b/core/res/res/anim/activity_open_enter.xml new file mode 100644 index 0000000..e4c7e9b --- /dev/null +++ b/core/res/res/anim/activity_open_enter.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, 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. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@anim/decelerate_interpolator"> + <translate android:fromXDelta="33%" android:toXDelta="0" + android:duration="@android:integer/config_mediumAnimTime"/> +</set> diff --git a/core/res/res/anim/activity_open_exit.xml b/core/res/res/anim/activity_open_exit.xml new file mode 100644 index 0000000..9d47b7f --- /dev/null +++ b/core/res/res/anim/activity_open_exit.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, 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. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@anim/decelerate_interpolator" + android:zAdjustment="top"> + <translate android:fromXDelta="0%" android:toXDelta="-100%" + android:duration="@android:integer/config_mediumAnimTime"/> +</set> diff --git a/core/res/res/anim/task_close_enter.xml b/core/res/res/anim/task_close_enter.xml index c289869..303cfd6 100644 --- a/core/res/res/anim/task_close_enter.xml +++ b/core/res/res/anim/task_close_enter.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. @@ -19,8 +18,9 @@ --> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@anim/decelerate_interpolator" - android:zAdjustment="top"> - <translate android:fromXDelta="-100%" android:toXDelta="0" - android:duration="@android:integer/config_mediumAnimTime"/> + android:interpolator="@anim/decelerate_interpolator"> + <scale android:fromXScale="2.0" android:toXScale="1.0" + android:fromYScale="2.0" android:toYScale="1.0" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="@android:integer/config_mediumAnimTime" /> </set> diff --git a/core/res/res/anim/task_close_exit.xml b/core/res/res/anim/task_close_exit.xml index 96fff94..a28ac3b 100644 --- a/core/res/res/anim/task_close_exit.xml +++ b/core/res/res/anim/task_close_exit.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. @@ -19,7 +18,12 @@ --> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@anim/decelerate_interpolator"> - <translate android:fromXDelta="0%" android:toXDelta="33%" - android:duration="@android:integer/config_mediumAnimTime"/> + android:interpolator="@anim/decelerate_interpolator" + android:zAdjustment="top"> + <scale android:fromXScale="1.0" android:toXScale=".5" + android:fromYScale="1.0" android:toYScale=".5" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="1.0" android:toAlpha="0" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/task_open_enter.xml b/core/res/res/anim/task_open_enter.xml index 8e7d049..234abb2 100644 --- a/core/res/res/anim/task_open_enter.xml +++ b/core/res/res/anim/task_open_enter.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. @@ -19,7 +18,12 @@ --> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@anim/decelerate_interpolator"> - <translate android:fromXDelta="33%" android:toXDelta="0" - android:duration="@android:integer/config_mediumAnimTime"/> + android:interpolator="@anim/decelerate_interpolator" + android:zAdjustment="top"> + <scale android:fromXScale=".5" android:toXScale="1.0" + android:fromYScale=".5" android:toYScale="1.0" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/task_open_exit.xml b/core/res/res/anim/task_open_exit.xml index 5e5c66d..98975fb 100644 --- a/core/res/res/anim/task_open_exit.xml +++ b/core/res/res/anim/task_open_exit.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. @@ -21,6 +20,8 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/decelerate_interpolator" android:zAdjustment="top"> - <translate android:fromXDelta="0%" android:toXDelta="-100%" - android:duration="@android:integer/config_mediumAnimTime"/> + <scale android:fromXScale="1.0" android:toXScale="2.0" + android:fromYScale="1.0" android:toYScale="2.0" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="@android:integer/config_mediumAnimTime" /> </set> diff --git a/core/res/res/anim/translucent_enter.xml b/core/res/res/anim/translucent_enter.xml new file mode 100644 index 0000000..fb4c1c3 --- /dev/null +++ b/core/res/res/anim/translucent_enter.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, 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. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@anim/decelerate_interpolator"> + <translate android:fromXDelta="75%" android:toXDelta="0" + android:duration="@android:integer/config_mediumAnimTime"/> + <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + android:duration="@android:integer/config_mediumAnimTime"/> +</set> diff --git a/core/res/res/anim/translucent_exit.xml b/core/res/res/anim/translucent_exit.xml new file mode 100644 index 0000000..1d424e1 --- /dev/null +++ b/core/res/res/anim/translucent_exit.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, 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. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@anim/accelerate_interpolator"> + <translate android:fromXDelta="0%" android:toXDelta="75%" + android:duration="@android:integer/config_mediumAnimTime"/> + <alpha android:fromAlpha="1.0" android:toAlpha="0" + android:duration="@android:integer/config_mediumAnimTime"/> +</set> diff --git a/core/res/res/anim/wallpaper_close_enter.xml b/core/res/res/anim/wallpaper_close_enter.xml index 8e7d049..e4c7e9b 100644 --- a/core/res/res/anim/wallpaper_close_enter.xml +++ b/core/res/res/anim/wallpaper_close_enter.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. diff --git a/core/res/res/anim/wallpaper_close_exit.xml b/core/res/res/anim/wallpaper_close_exit.xml index 0a63990..16edec1 100644 --- a/core/res/res/anim/wallpaper_close_exit.xml +++ b/core/res/res/anim/wallpaper_close_exit.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. @@ -21,10 +20,10 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/decelerate_interpolator" android:zAdjustment="top"> - <translate android:fromXDelta="0%" android:toXDelta="-100%" - android:duration="@android:integer/config_mediumAnimTime"/> <scale android:fromXScale="1.0" android:toXScale="2.0" android:fromYScale="1.0" android:toYScale="2.0" - android:pivotX="0%" android:pivotY="50%" + android:pivotX="100%p" android:pivotY="50%p" android:duration="@android:integer/config_mediumAnimTime" /> + <translate android:fromXDelta="0%" android:toXDelta="-100%" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/wallpaper_enter.xml b/core/res/res/anim/wallpaper_enter.xml index 981f5f6..c240a9a 100644 --- a/core/res/res/anim/wallpaper_enter.xml +++ b/core/res/res/anim/wallpaper_enter.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/*\ +** Copyright 2009, 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. diff --git a/core/res/res/anim/wallpaper_exit.xml b/core/res/res/anim/wallpaper_exit.xml index 2306071..742286f 100644 --- a/core/res/res/anim/wallpaper_exit.xml +++ b/core/res/res/anim/wallpaper_exit.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. diff --git a/core/res/res/anim/wallpaper_intra_close_enter.xml b/core/res/res/anim/wallpaper_intra_close_enter.xml index b75745d..5c4f5c9 100644 --- a/core/res/res/anim/wallpaper_intra_close_enter.xml +++ b/core/res/res/anim/wallpaper_intra_close_enter.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. @@ -23,9 +22,9 @@ android:zAdjustment="top"> <scale android:fromXScale="2.0" android:toXScale="1.0" android:fromYScale="2.0" android:toYScale="1.0" - android:pivotX="100%" android:pivotY="50%" + android:pivotX="100%p" android:pivotY="50%p" android:duration="@android:integer/config_mediumAnimTime" /> - <translate android:fromXDelta="-150%" android:toXDelta="0" + <translate android:fromXDelta="-150%p" android:toXDelta="0%p" android:duration="@android:integer/config_mediumAnimTime"/> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="@android:integer/config_mediumAnimTime" /> diff --git a/core/res/res/anim/wallpaper_intra_close_exit.xml b/core/res/res/anim/wallpaper_intra_close_exit.xml index 6a4e276..acaf773 100644 --- a/core/res/res/anim/wallpaper_intra_close_exit.xml +++ b/core/res/res/anim/wallpaper_intra_close_exit.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. @@ -22,9 +21,9 @@ android:interpolator="@anim/accelerate_interpolator"> <scale android:fromXScale="1.0" android:toXScale=".5" android:fromYScale="1.0" android:toYScale=".5" - android:pivotX="0%" android:pivotY="50%" + android:pivotX="100%p" android:pivotY="50%p" android:duration="@android:integer/config_mediumAnimTime" /> - <translate android:fromXDelta="0%" android:toXDelta="100%" + <translate android:fromXDelta="0%p" android:toXDelta="100%p" android:duration="@android:integer/config_mediumAnimTime"/> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="@android:integer/config_mediumAnimTime"/> diff --git a/core/res/res/anim/wallpaper_intra_open_enter.xml b/core/res/res/anim/wallpaper_intra_open_enter.xml index a46bc42..81c9991 100644 --- a/core/res/res/anim/wallpaper_intra_open_enter.xml +++ b/core/res/res/anim/wallpaper_intra_open_enter.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. @@ -22,9 +21,9 @@ android:interpolator="@anim/decelerate_interpolator"> <scale android:fromXScale=".5" android:toXScale="1.0" android:fromYScale=".5" android:toYScale="1.0" - android:pivotX="0%" android:pivotY="50%" + android:pivotX="100%p" android:pivotY="50%p" android:duration="@android:integer/config_mediumAnimTime" /> - <translate android:fromXDelta="100%" android:toXDelta="0" + <translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="@android:integer/config_mediumAnimTime"/> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="@android:integer/config_mediumAnimTime" /> diff --git a/core/res/res/anim/wallpaper_intra_open_exit.xml b/core/res/res/anim/wallpaper_intra_open_exit.xml index 0e9bc4a..28c4287 100644 --- a/core/res/res/anim/wallpaper_intra_open_exit.xml +++ b/core/res/res/anim/wallpaper_intra_open_exit.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. @@ -23,9 +22,9 @@ android:zAdjustment="top"> <scale android:fromXScale="1.0" android:toXScale="2.0" android:fromYScale="1.0" android:toYScale="2.0" - android:pivotX="100%" android:pivotY="50%" + android:pivotX="100%p" android:pivotY="50%p" android:duration="@android:integer/config_mediumAnimTime" /> - <translate android:fromXDelta="0" android:toXDelta="-150%" + <translate android:fromXDelta="0" android:toXDelta="-150%p" android:duration="@android:integer/config_mediumAnimTime"/> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="@android:integer/config_mediumAnimTime"/> diff --git a/core/res/res/anim/wallpaper_open_enter.xml b/core/res/res/anim/wallpaper_open_enter.xml index 9daf925..af22b47 100644 --- a/core/res/res/anim/wallpaper_open_enter.xml +++ b/core/res/res/anim/wallpaper_open_enter.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. @@ -21,10 +20,10 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/decelerate_interpolator" android:zAdjustment="top"> - <translate android:fromXDelta="-100%" android:toXDelta="0" - android:duration="@android:integer/config_mediumAnimTime"/> <scale android:fromXScale="2.0" android:toXScale="1.0" android:fromYScale="2.0" android:toYScale="1.0" - android:pivotX="0%" android:pivotY="50%" + android:pivotX="100%p" android:pivotY="50%p" android:duration="@android:integer/config_mediumAnimTime" /> + <translate android:fromXDelta="-100%" android:toXDelta="0" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/wallpaper_open_exit.xml b/core/res/res/anim/wallpaper_open_exit.xml index 96fff94..47cb6d6 100644 --- a/core/res/res/anim/wallpaper_open_exit.xml +++ b/core/res/res/anim/wallpaper_open_exit.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* +** Copyright 2009, 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. diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 18b9765..a2ceb8f 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -49,15 +49,15 @@ <item name="centerMedium">@android:drawable/popup_center_medium</item> </style> - <!-- Animations --> + <!-- Base style for animations. This style specifies no animations. --> <style name="Animation" /> <!-- Standard animations for a full-screen window or activity. --> <style name="Animation.Activity"> - <item name="activityOpenEnterAnimation">@anim/task_open_enter</item> - <item name="activityOpenExitAnimation">@anim/task_open_exit</item> - <item name="activityCloseEnterAnimation">@anim/task_close_enter</item> - <item name="activityCloseExitAnimation">@anim/task_close_exit</item> + <item name="activityOpenEnterAnimation">@anim/activity_open_enter</item> + <item name="activityOpenExitAnimation">@anim/activity_open_exit</item> + <item name="activityCloseEnterAnimation">@anim/activity_close_enter</item> + <item name="activityCloseExitAnimation">@anim/activity_close_exit</item> <item name="taskOpenEnterAnimation">@anim/task_open_enter</item> <item name="taskOpenExitAnimation">@anim/task_open_exit</item> <item name="taskCloseEnterAnimation">@anim/task_close_enter</item> @@ -88,8 +88,15 @@ <item name="windowExitAnimation">@anim/status_bar_exit</item> </style> - <!-- Standard animations for a translucent window or activity. --> + <!-- Standard animations for a translucent window or activity. This + style is <em>not<em> used by default for the translucent theme + (since translucent activities are a special case that have no + clear UI paradigm), but you can make your own specialized theme + with this animation style if you would like to have the standard + platform transition animation. --> <style name="Animation.Translucent"> + <item name="windowEnterAnimation">@anim/translucent_enter</item> + <item name="windowExitAnimation">@anim/translucent_exit</item> </style> <!-- Standard animations for a non-full-screen window or activity. --> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index bfdce1e..3b9590d 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -306,19 +306,22 @@ <style name="Theme.Translucent"> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowIsTranslucent">true</item> - <item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item> + <!-- Note that we use the base animation style here (that is no + animations) because we really have no idea how this kind of + activity will be used. --> + <item name="android:windowAnimationStyle">@android:style/Animation</item> </style> <!-- Variant of the translucent theme with no title bar --> <style name="Theme.Translucent.NoTitleBar"> <item name="android:windowNoTitle">true</item> + <item name="android:windowContentOverlay">@null</item> </style> <!-- Variant of the translucent theme that has no title bar and fills the entire screen --> <style name="Theme.Translucent.NoTitleBar.Fullscreen"> <item name="android:windowFullscreen">true</item> - <item name="android:windowContentOverlay">@null</item> </style> <!-- Default theme for activities that don't actually display a UI; that diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index c8ff6cb..b0e4038 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -8022,6 +8022,19 @@ public class WindowManagerService extends IWindowManager.Stub } } + WindowState findMainWindow() { + int j = windows.size(); + while (j > 0) { + j--; + WindowState win = windows.get(j); + if (win.mAttrs.type == WindowManager.LayoutParams.TYPE_BASE_APPLICATION + || win.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING) { + return win; + } + } + return null; + } + void dump(PrintWriter pw, String prefix) { super.dump(pw, prefix); if (appToken != null) { @@ -8088,71 +8101,6 @@ public class WindowManagerService extends IWindowManager.Stub } } - public static WindowManager.LayoutParams findAnimations( - ArrayList<AppWindowToken> order, - ArrayList<AppWindowToken> openingTokenList1, - ArrayList<AppWindowToken> closingTokenList2) { - // We need to figure out which animation to use... - - // First, check if there is a compatible window in opening/closing - // apps, and use it if exists. - WindowManager.LayoutParams animParams = null; - int animSrc = 0; - animParams = findCompatibleWindowParams(openingTokenList1); - if (animParams == null) { - animParams = findCompatibleWindowParams(closingTokenList2); - } - if (animParams != null) { - return animParams; - } - - //Log.i(TAG, "Looking for animations..."); - for (int i=order.size()-1; i>=0; i--) { - AppWindowToken wtoken = order.get(i); - //Log.i(TAG, "Token " + wtoken + " with " + wtoken.windows.size() + " windows"); - if (openingTokenList1.contains(wtoken) || closingTokenList2.contains(wtoken)) { - int j = wtoken.windows.size(); - while (j > 0) { - j--; - WindowState win = wtoken.windows.get(j); - //Log.i(TAG, "Window " + win + ": type=" + win.mAttrs.type); - if (win.mAttrs.type == WindowManager.LayoutParams.TYPE_BASE_APPLICATION - || win.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING) { - //Log.i(TAG, "Found base or application window, done!"); - if (wtoken.appFullscreen) { - return win.mAttrs; - } - if (animSrc < 2) { - animParams = win.mAttrs; - animSrc = 2; - } - } else if (animSrc < 1 && win.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION) { - //Log.i(TAG, "Found normal window, we may use this..."); - animParams = win.mAttrs; - animSrc = 1; - } - } - } - } - - return animParams; - } - - private static LayoutParams findCompatibleWindowParams(ArrayList<AppWindowToken> tokenList) { - for (int appCount = tokenList.size() - 1; appCount >= 0; appCount--) { - AppWindowToken wtoken = tokenList.get(appCount); - // Just checking one window is sufficient as all windows have the compatible flag - // if the application is in compatibility mode. - if (wtoken.windows.size() > 0) { - WindowManager.LayoutParams params = wtoken.windows.get(0).mAttrs; - if ((params.flags & FLAG_COMPATIBLE_WINDOW) != 0) { - return params; - } - } - } - return null; - } - // ------------------------------------------------------------- // DummyAnimation // ------------------------------------------------------------- @@ -9043,35 +8991,56 @@ public class WindowManagerService extends IWindowManager.Stub adjustWallpaperWindowsLocked(); wallpaperMayChange = false; + // The top-most window will supply the layout params, + // and we will determine it below. + LayoutParams animLp = null; + int bestAnimLayer = -1; + if (DEBUG_APP_TRANSITIONS) Log.v(TAG, "New wallpaper target=" + mWallpaperTarget + ", lower target=" + mLowerWallpaperTarget + ", upper target=" + mUpperWallpaperTarget); int foundWallpapers = 0; - if (mLowerWallpaperTarget != null) { - // Need to determine if both the closing and - // opening app token sets are wallpaper targets, - // in which case special animations are needed - // (since the wallpaper needs to stay static - // behind them). - NN = mClosingApps.size(); - for (i=0; i<NN; i++) { - AppWindowToken wtoken = mClosingApps.get(i); - if (mLowerWallpaperTarget.mAppToken == wtoken) { - foundWallpapers |= 1; - } - if (mUpperWallpaperTarget.mAppToken == wtoken) { - foundWallpapers |= 1; - } + // Do a first pass through the tokens for two + // things: + // (1) Determine if both the closing and opening + // app token sets are wallpaper targets, in which + // case special animations are needed + // (since the wallpaper needs to stay static + // behind them). + // (2) Find the layout params of the top-most + // application window in the tokens, which is + // what will control the animation theme. + final int NC = mClosingApps.size(); + NN = NC + mOpeningApps.size(); + for (i=0; i<NN; i++) { + AppWindowToken wtoken; + int mode; + if (i < NC) { + wtoken = mClosingApps.get(i); + mode = 1; + } else { + wtoken = mOpeningApps.get(i-NC); + mode = 2; } - NN = mOpeningApps.size(); - for (i=0; i<NN; i++) { - AppWindowToken wtoken = mOpeningApps.get(i); - if (mLowerWallpaperTarget.mAppToken == wtoken) { - foundWallpapers |= 2; + if (mLowerWallpaperTarget != null) { + if (mLowerWallpaperTarget.mAppToken == wtoken + || mUpperWallpaperTarget.mAppToken == wtoken) { + foundWallpapers |= mode; } - if (mUpperWallpaperTarget.mAppToken == wtoken) { - foundWallpapers |= 2; + } + if (wtoken.appFullscreen) { + WindowState ws = wtoken.findMainWindow(); + if (ws != null) { + // If this is a compatibility mode + // window, we will always use its anim. + if ((ws.mAttrs.flags&FLAG_COMPATIBLE_WINDOW) != 0) { + animLp = ws.mAttrs; + bestAnimLayer = Integer.MAX_VALUE; + } else if (ws.mLayer > bestAnimLayer) { + animLp = ws.mAttrs; + bestAnimLayer = ws.mLayer; + } } } } @@ -9107,10 +9076,6 @@ public class WindowManagerService extends IWindowManager.Stub "New transit into wallpaper: " + transit); } - // We need to figure out which animation to use... - WindowManager.LayoutParams lp = findAnimations(mAppTokens, - mOpeningApps, mClosingApps); - NN = mOpeningApps.size(); for (i=0; i<NN; i++) { AppWindowToken wtoken = mOpeningApps.get(i); @@ -9119,7 +9084,7 @@ public class WindowManagerService extends IWindowManager.Stub wtoken.reportedVisible = false; wtoken.inPendingTransaction = false; wtoken.animation = null; - setTokenVisibilityLocked(wtoken, lp, true, transit, false); + setTokenVisibilityLocked(wtoken, animLp, true, transit, false); wtoken.updateReportedVisibilityLocked(); wtoken.waitingToShow = false; wtoken.showAllWindowsLocked(); @@ -9131,7 +9096,7 @@ public class WindowManagerService extends IWindowManager.Stub "Now closing app" + wtoken); wtoken.inPendingTransaction = false; wtoken.animation = null; - setTokenVisibilityLocked(wtoken, lp, false, transit, false); + setTokenVisibilityLocked(wtoken, animLp, false, transit, false); wtoken.updateReportedVisibilityLocked(); wtoken.waitingToHide = false; // Force the allDrawn flag, because we want to start diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 0b86fc0..66ef557 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -33,6 +33,7 @@ import android.app.AlertDialog; import android.app.ApplicationErrorReport; import android.app.Dialog; import android.app.IActivityController; +import android.app.IActivityManager; import android.app.IActivityWatcher; import android.app.IApplicationThread; import android.app.IInstrumentationWatcher; @@ -3612,6 +3613,29 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } + public int startActivityPendingIntent(IApplicationThread caller, + PendingIntent intent, Intent fillInIntent, String resolvedType, + IBinder resultTo, String resultWho, int requestCode, + int flagsMask, int flagsValues) { + // Refuse possible leaked file descriptors + if (fillInIntent != null && fillInIntent.hasFileDescriptors()) { + throw new IllegalArgumentException("File descriptors passed in Intent"); + } + + IIntentSender sender = intent.getTarget(); + if (!(sender instanceof PendingIntentRecord)) { + throw new IllegalArgumentException("Bad PendingIntent object"); + } + + PendingIntentRecord pir = (PendingIntentRecord)sender; + if (pir.key.type != IActivityManager.INTENT_SENDER_ACTIVITY) { + return START_NOT_ACTIVITY; + } + + return pir.sendInner(0, fillInIntent, resolvedType, + null, resultTo, resultWho, requestCode, flagsMask, flagsValues); + } + public boolean startNextMatchingActivity(IBinder callingActivity, Intent intent) { // Refuse possible leaked file descriptors @@ -12918,15 +12942,6 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } if (app.services.size() != 0 && adj > FOREGROUND_APP_ADJ) { - // If this process has active services running in it, we would - // like to avoid killing it unless it would prevent the current - // application from running. By default we put the process in - // with the rest of the background processes; as we scan through - // its services we may bump it up from there. - if (adj > hiddenAdj) { - adj = hiddenAdj; - app.adjType = "bg-services"; - } final long now = SystemClock.uptimeMillis(); // This process is more important if the top activity is // bound to the service. @@ -12994,17 +13009,19 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } } + + // Finally, f this process has active services running in it, we + // would like to avoid killing it unless it would prevent the current + // application from running. By default we put the process in + // with the rest of the background processes; as we scan through + // its services we may bump it up from there. + if (adj > hiddenAdj) { + adj = hiddenAdj; + app.adjType = "bg-services"; + } } if (app.pubProviders.size() != 0 && adj > FOREGROUND_APP_ADJ) { - // If this process has published any content providers, then - // its adjustment makes it at least as important as any of the - // processes using those providers, and no less important than - // CONTENT_PROVIDER_ADJ, which is just shy of EMPTY. - if (adj > CONTENT_PROVIDER_ADJ) { - adj = CONTENT_PROVIDER_ADJ; - app.adjType = "pub-providers"; - } Iterator jt = app.pubProviders.values().iterator(); while (jt.hasNext() && adj > FOREGROUND_APP_ADJ) { ContentProviderRecord cpr = (ContentProviderRecord)jt.next(); @@ -13048,6 +13065,15 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } } + + // Finally, if this process has published any content providers, + // then its adjustment makes it at least as important as any of the + // processes using those providers, and no less important than + // CONTENT_PROVIDER_ADJ, which is just shy of EMPTY. + if (adj > CONTENT_PROVIDER_ADJ) { + adj = CONTENT_PROVIDER_ADJ; + app.adjType = "pub-providers"; + } } app.curRawAdj = adj; diff --git a/services/java/com/android/server/am/PendingIntentRecord.java b/services/java/com/android/server/am/PendingIntentRecord.java index fa2a100..d994362 100644 --- a/services/java/com/android/server/am/PendingIntentRecord.java +++ b/services/java/com/android/server/am/PendingIntentRecord.java @@ -22,6 +22,7 @@ import android.content.IIntentReceiver; import android.app.PendingIntent; import android.content.Intent; import android.os.Binder; +import android.os.IBinder; import android.os.RemoteException; import android.util.Log; @@ -172,6 +173,14 @@ class PendingIntentRecord extends IIntentSender.Stub { public int send(int code, Intent intent, String resolvedType, IIntentReceiver finishedReceiver) { + return sendInner(code, intent, resolvedType, finishedReceiver, + null, null, 0, 0, 0); + } + + int sendInner(int code, Intent intent, String resolvedType, + IIntentReceiver finishedReceiver, + IBinder resultTo, String resultWho, int requestCode, + int flagsMask, int flagsValues) { synchronized(owner) { if (!canceled) { sent = true; @@ -189,6 +198,8 @@ class PendingIntentRecord extends IIntentSender.Stub { } else { resolvedType = key.requestResolvedType; } + flagsValues &= flagsMask; + finalIntent.setFlags((finalIntent.getFlags()&~flagsMask) | flagsValues); final long origId = Binder.clearCallingIdentity(); @@ -198,7 +209,7 @@ class PendingIntentRecord extends IIntentSender.Stub { try { owner.startActivityInPackage(uid, finalIntent, resolvedType, - null, null, 0, false); + resultTo, resultWho, requestCode, false); } catch (RuntimeException e) { Log.w(ActivityManagerService.TAG, "Unable to send startActivity intent", e); @@ -246,7 +257,7 @@ class PendingIntentRecord extends IIntentSender.Stub { return 0; } } - return -1; + return IActivityManager.START_CANCELED; } protected void finalize() throws Throwable { |