diff options
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/app/Activity.java | 8 | ||||
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 21 | ||||
-rw-r--r-- | core/java/android/app/ActivityThread.java | 16 | ||||
-rw-r--r-- | core/java/android/app/ApplicationThreadNative.java | 18 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 2 | ||||
-rw-r--r-- | core/java/android/app/IApplicationThread.java | 2 |
6 files changed, 67 insertions, 0 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index cac646d..2ebfa1d 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -5501,6 +5501,14 @@ public class Activity extends ContextThemeWrapper } /** + * Activities cannot draw during the period that their windows are animating in. In order + * to know when it is safe to begin drawing they can override this method which will be + * called when the entering animation has completed. + */ + public void onEnterAnimationComplete() { + } + + /** * Adjust the current immersive mode setting. * * Note that changing this value will have no effect on the activity's diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 318a520..311a8f55 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -2231,6 +2231,14 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeNoException(); return true; } + + case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IBinder token = data.readStrongBinder(); + notifyEnterAnimationComplete(token); + reply.writeNoException(); + return true; + } } return super.onTransact(code, data, reply, flags); @@ -5146,5 +5154,18 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); } + @Override + public void notifyEnterAnimationComplete(IBinder token) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(token); + mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, + IBinder.FLAG_ONEWAY); + reply.readException(); + data.recycle(); + reply.recycle(); + } + private IBinder mRemote; } diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 48954f4..0bab7b2 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -1163,6 +1163,10 @@ public final class ActivityThread { public void scheduleBackgroundMediaPlayingChanged(IBinder token, boolean playing) { sendMessage(H.BACKGROUND_MEDIA_PLAYING_CHANGED, token, playing ? 1 : 0); } + + public void scheduleEnterAnimationComplete(IBinder token) { + sendMessage(H.ENTER_ANIMATION_COMPLETE, token); + } } private class H extends Handler { @@ -1215,6 +1219,7 @@ public final class ActivityThread { public static final int ON_NEW_ACTIVITY_OPTIONS = 146; public static final int STOP_MEDIA_PLAYING = 147; public static final int BACKGROUND_MEDIA_PLAYING_CHANGED = 148; + public static final int ENTER_ANIMATION_COMPLETE = 149; String codeToString(int code) { if (DEBUG_MESSAGES) { @@ -1267,6 +1272,7 @@ public final class ActivityThread { case ON_NEW_ACTIVITY_OPTIONS: return "ON_NEW_ACTIVITY_OPTIONS"; case STOP_MEDIA_PLAYING: return "STOP_MEDIA_PLAYING"; case BACKGROUND_MEDIA_PLAYING_CHANGED: return "BACKGROUND_MEDIA_PLAYING_CHANGED"; + case ENTER_ANIMATION_COMPLETE: return "ENTER_ANIMATION_COMPLETE"; } } return Integer.toString(code); @@ -1491,6 +1497,9 @@ public final class ActivityThread { case BACKGROUND_MEDIA_PLAYING_CHANGED: handleOnBackgroundMediaPlayingChanged((IBinder) msg.obj, msg.arg1 > 0); break; + case ENTER_ANIMATION_COMPLETE: + handleEnterAnimationComplete((IBinder) msg.obj); + break; } if (DEBUG_MESSAGES) Slog.v(TAG, "<<< done: " + codeToString(msg.what)); } @@ -2509,6 +2518,13 @@ public final class ActivityThread { installContentProviders(mInitialApplication, Lists.newArrayList(info)); } + private void handleEnterAnimationComplete(IBinder token) { + ActivityClientRecord r = mActivities.get(token); + if (r != null) { + r.activity.onEnterAnimationComplete(); + } + } + private static final ThreadLocal<Intent> sCurrentBroadcastIntent = new ThreadLocal<Intent>(); /** diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index 0b4510f..e9d4bd9 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -666,6 +666,15 @@ public abstract class ApplicationThreadNative extends Binder reply.writeNoException(); return true; } + + case ENTER_ANIMATION_COMPLETE_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + IBinder token = data.readStrongBinder(); + scheduleEnterAnimationComplete(token); + reply.writeNoException(); + return true; + } } return super.onTransact(code, data, reply, flags); @@ -1342,4 +1351,13 @@ class ApplicationThreadProxy implements IApplicationThread { mRemote.transact(BACKGROUND_MEDIA_PLAYING_CHANGED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); } + + @Override + public void scheduleEnterAnimationComplete(IBinder token) throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + data.writeStrongBinder(token); + mRemote.transact(ENTER_ANIMATION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); + data.recycle(); + } } diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 53c1408..5347f03 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -448,6 +448,7 @@ public interface IActivityManager extends IInterface { public void mediaResourcesReleased(IBinder token) throws RemoteException; public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException; + public void notifyEnterAnimationComplete(IBinder token) throws RemoteException; /* * Private non-Binder interfaces @@ -758,4 +759,5 @@ public interface IActivityManager extends IInterface { int MEDIA_RESOURCES_RELEASED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+227; int NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+228; int START_ACTIVITY_FROM_RECENTS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 229; + int NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+230; } diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java index 18faf0e..4a1fda4 100644 --- a/core/java/android/app/IApplicationThread.java +++ b/core/java/android/app/IApplicationThread.java @@ -147,6 +147,7 @@ public interface IApplicationThread extends IInterface { void updateTimePrefs(boolean is24Hour) throws RemoteException; void scheduleStopMediaPlaying(IBinder token) throws RemoteException; void scheduleBackgroundMediaPlayingChanged(IBinder token, boolean enabled) throws RemoteException; + void scheduleEnterAnimationComplete(IBinder token) throws RemoteException; String descriptor = "android.app.IApplicationThread"; @@ -203,4 +204,5 @@ public interface IApplicationThread extends IInterface { int UPDATE_TIME_PREFS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+51; int STOP_MEDIA_PLAYING_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+52; int BACKGROUND_MEDIA_PLAYING_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+53; + int ENTER_ANIMATION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+54; } |