summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-09-24 19:22:12 -0700
committerDianne Hackborn <hackbod@google.com>2009-09-25 00:48:02 -0700
commit3b3e145d3c41fd68974e08f799b1fd1f8f060cf0 (patch)
tree3f699e0b2f51bfce7061ef87b2690c8ab1032a64 /core/java/android
parentfdf53a4628f915203752660aa07049aa22c01b5a (diff)
downloadframeworks_base-3b3e145d3c41fd68974e08f799b1fd1f8f060cf0.zip
frameworks_base-3b3e145d3c41fd68974e08f799b1fd1f8f060cf0.tar.gz
frameworks_base-3b3e145d3c41fd68974e08f799b1fd1f8f060cf0.tar.bz2
A variety of work on animations.
- The lock screen now fades in and out. - Fixed a bug where we would accidentally freeze the screen when switching to an activity with a different orientation than the current (but the screen itself is in the current orientation). This would mess up the animations on the car dock. - New API to force a particular animation for an activity transition (untested). - New wallpaper animations. - Resources now uses the next API version when in a development build, to help applications being developed against such builds. Change-Id: I2d9998f8400967ff09a04d693dc4ce55f0dbef5b
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/Activity.java17
-rw-r--r--core/java/android/app/ActivityManagerNative.java25
-rw-r--r--core/java/android/app/IActivityManager.java4
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java2
-rw-r--r--core/java/android/content/res/Resources.java7
-rw-r--r--core/java/android/view/IWindowManager.aidl1
-rw-r--r--core/java/android/view/WindowManager.java7
-rw-r--r--core/java/android/view/WindowManagerPolicy.java60
8 files changed, 105 insertions, 18 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 4561899..8755477 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -3015,6 +3015,23 @@ public class Activity extends ContextThemeWrapper
}
/**
+ * Call immediately after one of the flavors of {@link #startActivity(Intent)}
+ * or {@link #finish} to specify an explicit transition animation to
+ * perform next.
+ * @param enterAnim A resource ID of the animation resource to use for
+ * the incoming activity.
+ * @param exitAnim A resource ID of the animation resource to use for
+ * the outgoing activity.
+ */
+ public void overridePendingTransition(int enterAnim, int exitAnim) {
+ try {
+ ActivityManagerNative.getDefault().overridePendingTransition(
+ mToken, getPackageName(), enterAnim, exitAnim);
+ } catch (RemoteException e) {
+ }
+ }
+
+ /**
* 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 82d49e3..2d7658a 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1153,6 +1153,16 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
reply.writeNoException();
return true;
}
+
+ case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ IBinder token = data.readStrongBinder();
+ String packageName = data.readString();
+ int enterAnim = data.readInt();
+ int exitAnim = data.readInt();
+ overridePendingTransition(token, packageName, enterAnim, exitAnim);
+ return true;
+ }
}
return super.onTransact(code, data, reply, flags);
@@ -2530,5 +2540,20 @@ class ActivityManagerProxy implements IActivityManager
reply.recycle();
}
+ public void overridePendingTransition(IBinder token, String packageName,
+ int enterAnim, int exitAnim) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken(IActivityManager.descriptor);
+ data.writeStrongBinder(token);
+ data.writeString(packageName);
+ data.writeInt(enterAnim);
+ data.writeInt(exitAnim);
+ mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
+ reply.readException();
+ data.recycle();
+ reply.recycle();
+ }
+
private IBinder mRemote;
}
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 110b72d..7ad7561 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -285,6 +285,9 @@ public interface IActivityManager extends IInterface {
public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
throws RemoteException;
+ public void overridePendingTransition(IBinder token, String packageName,
+ int enterAnim, int exitAnim) throws RemoteException;
+
/*
* Private non-Binder interfaces
*/
@@ -444,4 +447,5 @@ public interface IActivityManager extends IInterface {
int GET_PROCESS_MEMORY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+97;
int KILL_APPLICATION_PROCESS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+98;
int START_ACTIVITY_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+99;
+ int OVERRIDE_PENDING_TRANSITION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+100;
}
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 8839f95..7a65af8 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -253,7 +253,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
public int uid;
/**
- * The minimum SDK version this application targets. It may run on earilier
+ * The minimum SDK version this application targets. It may run on earlier
* versions, but it knows how to work with any new behavior added at this
* version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}
* if this is a development build and the app is targeting that. You should
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 3796201..00ab7de 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -25,6 +25,7 @@ import org.xmlpull.v1.XmlPullParserException;
import android.graphics.Movie;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
import android.os.Bundle;
import android.os.SystemProperties;
import android.util.AttributeSet;
@@ -50,8 +51,10 @@ public class Resources {
private static final boolean DEBUG_CONFIG = false;
private static final boolean TRACE_FOR_PRELOAD = false;
- private static final int sSdkVersion = SystemProperties.getInt(
- "ro.build.version.sdk", 0);
+ // Use the current SDK version code. If we are a development build,
+ // also allow the previous SDK version + 1.
+ private static final int sSdkVersion = Build.VERSION.SDK_INT
+ + ("REL".equals(Build.VERSION.CODENAME) ? 1 : 0);
private static final Object mSync = new Object();
private static Resources mSystem = null;
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 7d1872a..23e7fb7 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -71,6 +71,7 @@ interface IWindowManager
void setFocusedApp(IBinder token, boolean moveFocusNow);
void prepareAppTransition(int transit);
int getPendingAppTransition();
+ void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim);
void executeAppTransition();
void setAppStartingWindow(IBinder token, String pkg, int theme,
CharSequence nonLocalizedLabel, int labelRes,
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 396e380..7a22301 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -522,6 +522,13 @@ public interface WindowManager extends ViewManager {
* also been set. */
public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
+ /** Window flag: *sigh* The lock screen wants to continue running its
+ * animation while it is fading. A kind-of hack to allow this. Maybe
+ * in the future we just make this the default behavior.
+ *
+ * {@hide} */
+ public static final int FLAG_KEEP_SURFACE_WHILE_ANIMATING = 0x10000000;
+
/** Window flag: special flag to limit the size of the window to be
* original size ([320x480] x density). Used to create window for applications
* running under compatibility mode.
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 1923743..b3125b2 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -314,50 +314,60 @@ public interface WindowManagerPolicy {
public boolean showLw(boolean doAnimation);
}
+ /**
+ * Bit mask that is set for all enter transition.
+ */
+ public final int TRANSIT_ENTER_MASK = 0x1000;
+
+ /**
+ * Bit mask that is set for all exit transitions.
+ */
+ public final int TRANSIT_EXIT_MASK = 0x2000;
+
/** Not set up for a transition. */
- public final int TRANSIT_UNSET = 0;
+ public final int TRANSIT_UNSET = -1;
/** No animation for transition. */
public final int TRANSIT_NONE = 0;
/** Window has been added to the screen. */
- public final int TRANSIT_ENTER = 1;
+ public final int TRANSIT_ENTER = 1 | TRANSIT_ENTER_MASK;
/** Window has been removed from the screen. */
- public final int TRANSIT_EXIT = 2;
+ public final int TRANSIT_EXIT = 2 | TRANSIT_EXIT_MASK;
/** Window has been made visible. */
- public final int TRANSIT_SHOW = 3;
+ public final int TRANSIT_SHOW = 3 | TRANSIT_ENTER_MASK;
/** Window has been made invisible. */
- public final int TRANSIT_HIDE = 4;
+ public final int TRANSIT_HIDE = 4 | TRANSIT_EXIT_MASK;
/** The "application starting" preview window is no longer needed, and will
* animate away to show the real window. */
public final int TRANSIT_PREVIEW_DONE = 5;
/** A window in a new activity is being opened on top of an existing one
* in the same task. */
- public final int TRANSIT_ACTIVITY_OPEN = 6;
+ public final int TRANSIT_ACTIVITY_OPEN = 6 | TRANSIT_ENTER_MASK;
/** The window in the top-most activity is being closed to reveal the
* previous activity in the same task. */
- public final int TRANSIT_ACTIVITY_CLOSE = 7;
+ public final int TRANSIT_ACTIVITY_CLOSE = 7 | TRANSIT_EXIT_MASK;
/** A window in a new task is being opened on top of an existing one
* in another activity's task. */
- public final int TRANSIT_TASK_OPEN = 8;
+ public final int TRANSIT_TASK_OPEN = 8 | TRANSIT_ENTER_MASK;
/** A window in the top-most activity is being closed to reveal the
* previous activity in a different task. */
- public final int TRANSIT_TASK_CLOSE = 9;
+ public final int TRANSIT_TASK_CLOSE = 9 | TRANSIT_EXIT_MASK;
/** A window in an existing task is being displayed on top of an existing one
* in another activity's task. */
- public final int TRANSIT_TASK_TO_FRONT = 10;
+ public final int TRANSIT_TASK_TO_FRONT = 10 | TRANSIT_ENTER_MASK;
/** A window in an existing task is being put below all other tasks. */
- public final int TRANSIT_TASK_TO_BACK = 11;
+ public final int TRANSIT_TASK_TO_BACK = 11 | TRANSIT_EXIT_MASK;
/** A window in a new activity that doesn't have a wallpaper is being
* opened on top of one that does, effectively closing the wallpaper. */
- public final int TRANSIT_WALLPAPER_CLOSE = 12;
+ public final int TRANSIT_WALLPAPER_CLOSE = 12 | TRANSIT_EXIT_MASK;
/** A window in a new activity that does have a wallpaper is being
* opened on one that didn't, effectively opening the wallpaper. */
- public final int TRANSIT_WALLPAPER_OPEN = 13;
+ public final int TRANSIT_WALLPAPER_OPEN = 13 | TRANSIT_ENTER_MASK;
/** A window in a new activity is being opened on top of an existing one,
* and both are on top of the wallpaper. */
- public final int TRANSIT_WALLPAPER_INTRA_OPEN = 14;
+ public final int TRANSIT_WALLPAPER_INTRA_OPEN = 14 | TRANSIT_ENTER_MASK;
/** The window in the top-most activity is being closed to reveal the
* previous activity, and both are on top of he wallpaper. */
- public final int TRANSIT_WALLPAPER_INTRA_CLOSE = 15;
+ public final int TRANSIT_WALLPAPER_INTRA_CLOSE = 15 | TRANSIT_EXIT_MASK;
/** Screen turned off because of power button */
public final int OFF_BECAUSE_OF_USER = 1;
@@ -444,6 +454,21 @@ public interface WindowManagerPolicy {
public int getMaxWallpaperLayer();
/**
+ * Return whether the given window should forcibly hide everything
+ * behind it. Typically returns true for the keyguard.
+ */
+ public boolean doesForceHide(WindowState win, WindowManager.LayoutParams attrs);
+
+ /**
+ * Determine if a window that is behind one that is force hiding
+ * (as determined by {@link #doesForceHide}) should actually be hidden.
+ * For example, typically returns false for the status bar. Be careful
+ * to return false for any window that you may hide yourself, since this
+ * will conflict with what you set.
+ */
+ public boolean canBeForceHidden(WindowState win, WindowManager.LayoutParams attrs);
+
+ /**
* Called when the system would like to show a UI to indicate that an
* application is starting. You can use this to add a
* APPLICATION_STARTING_TYPE window with the given appToken to the window
@@ -524,6 +549,11 @@ public interface WindowManagerPolicy {
public int selectAnimationLw(WindowState win, int transit);
/**
+ * Create and return an animation to re-display a force hidden window.
+ */
+ public Animation createForceHideEnterAnimation();
+
+ /**
* Called from the key queue thread before a key is dispatched to the
* input thread.
*