Loading core/java/android/app/ActivityOptions.java +57 −9 Original line number Diff line number Diff line Loading @@ -130,6 +130,13 @@ public class ActivityOptions { */ public static final String KEY_ANIM_START_LISTENER = "android:activity.animStartListener"; /** * Callback for when the last frame of the animation is played. * @hide */ private static final String KEY_ANIMATION_FINISHED_LISTENER = "android:activity.animationFinishedListener"; /** * Descriptions of app transition animations to be played during the activity launch. */ Loading Loading @@ -198,6 +205,7 @@ public class ActivityOptions { private int mWidth; private int mHeight; private IRemoteCallback mAnimationStartedListener; private IRemoteCallback mAnimationFinishedListener; private ResultReceiver mTransitionReceiver; private boolean mIsReturning; private ArrayList<String> mSharedElementNames; Loading Loading @@ -280,16 +288,15 @@ public class ActivityOptions { return opts; } private void setOnAnimationStartedListener(Handler handler, OnAnimationStartedListener listener) { private void setOnAnimationStartedListener(final Handler handler, final OnAnimationStartedListener listener) { if (listener != null) { final Handler h = handler; final OnAnimationStartedListener finalListener = listener; mAnimationStartedListener = new IRemoteCallback.Stub() { @Override public void sendResult(Bundle data) throws RemoteException { h.post(new Runnable() { @Override public void sendResult(Bundle data) throws RemoteException { handler.post(new Runnable() { @Override public void run() { finalListener.onAnimationStarted(); listener.onAnimationStarted(); } }); } Loading @@ -306,6 +313,32 @@ public class ActivityOptions { void onAnimationStarted(); } private void setOnAnimationFinishedListener(final Handler handler, final OnAnimationFinishedListener listener) { if (listener != null) { mAnimationFinishedListener = new IRemoteCallback.Stub() { @Override public void sendResult(Bundle data) throws RemoteException { handler.post(new Runnable() { @Override public void run() { listener.onAnimationFinished(); } }); } }; } } /** * Callback for use with {@link ActivityOptions#makeThumbnailAspectScaleDownAnimation} * to find out when the given animation has drawn its last frame. * @hide */ public interface OnAnimationFinishedListener { void onAnimationFinished(); } /** * Create an ActivityOptions specifying an animation where the new * activity is scaled from a small originating area of the screen to Loading Loading @@ -523,12 +556,14 @@ public class ActivityOptions { /** @hide */ public static ActivityOptions makeThumbnailAspectScaleDownAnimation(View source, AppTransitionAnimationSpec[] specs, Handler handler, OnAnimationStartedListener listener) { OnAnimationStartedListener onAnimationStartedListener, OnAnimationFinishedListener onAnimationFinishedListener) { ActivityOptions opts = new ActivityOptions(); opts.mPackageName = source.getContext().getPackageName(); opts.mAnimationType = ANIM_THUMBNAIL_ASPECT_SCALE_DOWN; opts.mAnimSpecs = specs; opts.setOnAnimationStartedListener(handler, listener); opts.setOnAnimationStartedListener(handler, onAnimationStartedListener); opts.setOnAnimationFinishedListener(handler, onAnimationFinishedListener); return opts; } Loading Loading @@ -725,6 +760,10 @@ public class ActivityOptions { mAnimSpecs[i] = (AppTransitionAnimationSpec) specs[i]; } } if (opts.containsKey(KEY_ANIMATION_FINISHED_LISTENER)) { mAnimationFinishedListener = IRemoteCallback.Stub.asInterface( opts.getBinder(KEY_ANIMATION_FINISHED_LISTENER)); } } /** @hide */ Loading Loading @@ -799,6 +838,11 @@ public class ActivityOptions { return mAnimationStartedListener; } /** @hide */ public IRemoteCallback getAnimationFinishedListener() { return mAnimationFinishedListener; } /** @hide */ public int getExitCoordinatorKey() { return mExitCoordinatorIndex; } Loading Loading @@ -929,6 +973,7 @@ public class ActivityOptions { break; } mAnimSpecs = otherOptions.mAnimSpecs; mAnimationFinishedListener = otherOptions.mAnimationFinishedListener; } /** Loading Loading @@ -998,6 +1043,9 @@ public class ActivityOptions { if (mAnimSpecs != null) { b.putParcelableArray(KEY_ANIM_SPECS, mAnimSpecs); } if (mAnimationFinishedListener != null) { b.putBinder(KEY_ANIMATION_FINISHED_LISTENER, mAnimationFinishedListener.asBinder()); } return b; } Loading core/java/android/view/IWindowManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -138,7 +138,7 @@ interface IWindowManager * @hide */ void overridePendingAppTransitionMultiThumb(in AppTransitionAnimationSpec[] specs, IRemoteCallback startedCallback, boolean scaleUp); IRemoteCallback startedCallback, IRemoteCallback finishedCallback, boolean scaleUp); void overridePendingAppTransitionInPlace(String packageName, int anim); void executeAppTransition(); void setAppStartingWindow(IBinder token, String pkg, int theme, Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +16 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.Bundle; import android.os.SystemClock; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.ViewStub; Loading @@ -43,6 +42,7 @@ import com.android.systemui.recents.events.activity.AppWidgetProviderChangedEven import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationStartedEvent; import com.android.systemui.recents.events.activity.HideRecentsEvent; import com.android.systemui.recents.events.activity.IterateRecentsEvent; import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent; import com.android.systemui.recents.events.activity.ToggleRecentsEvent; import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent; import com.android.systemui.recents.events.component.ScreenPinningRequestEvent; Loading Loading @@ -418,6 +418,17 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView MetricsLogger.visible(this, MetricsLogger.OVERVIEW_ACTIVITY); } @Override protected void onResume() { super.onResume(); final RecentsActivityLaunchState state = Recents.getConfiguration().getLaunchState(); if (state.startHidden) { state.startHidden = false; mRecentsView.setVisibility(View.INVISIBLE); } } @Override protected void onPause() { super.onPause(); Loading Loading @@ -645,6 +656,10 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView ctx.postAnimationTrigger.decrement(); } public final void onBusEvent(EnterRecentsWindowLastAnimationFrameEvent event) { mRecentsView.setVisibility(View.VISIBLE); } public final void onBusEvent(AppWidgetProviderChangedEvent event) { refreshSearchWidgetView(); } Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +1 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ public class RecentsActivityLaunchState { public boolean launchedFromSearchHome; public boolean launchedReuseTaskStackViews; public boolean launchedHasConfigurationChanged; public boolean startHidden; public int launchedToTaskId; public int launchedNumVisibleTasks; public int launchedNumVisibleThumbnails; Loading packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +9 −3 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationStartedEvent; import com.android.systemui.recents.events.activity.HideRecentsEvent; import com.android.systemui.recents.events.activity.IterateRecentsEvent; import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent; import com.android.systemui.recents.events.activity.ToggleRecentsEvent; import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent; import com.android.systemui.recents.events.component.ScreenPinningRequestEvent; Loading @@ -69,7 +70,7 @@ import java.util.ArrayList; * be called remotely from the system user. */ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements ActivityOptions.OnAnimationStartedListener { implements ActivityOptions.OnAnimationStartedListener, ActivityOptions.OnAnimationFinishedListener { private final static String TAG = "RecentsImpl"; private final static boolean DEBUG = false; Loading @@ -79,7 +80,6 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub public final static String RECENTS_PACKAGE = "com.android.systemui"; public final static String RECENTS_ACTIVITY = "com.android.systemui.recents.RecentsActivity"; /** * An implementation of ITaskStackListener, that allows us to listen for changes to the system * task stacks and update recents accordingly. Loading Loading @@ -579,7 +579,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()]; specs.toArray(specsArray); return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, this); specsArray, mHandler, this, this); } else { // Update the destination rect Task toTask = new Task(); Loading Loading @@ -757,6 +757,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub launchState.launchedNumVisibleTasks = vr.numVisibleTasks; launchState.launchedNumVisibleThumbnails = vr.numVisibleThumbnails; launchState.launchedHasConfigurationChanged = false; launchState.startHidden = topTask != null && topTask.stackId == FREEFORM_WORKSPACE_STACK_ID; Intent intent = new Intent(); intent.setClassName(RECENTS_PACKAGE, RECENTS_ACTIVITY); Loading @@ -781,4 +782,9 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub EventBus.getDefault().post(new EnterRecentsWindowAnimationStartedEvent()); } } @Override public void onAnimationFinished() { EventBus.getDefault().post(new EnterRecentsWindowLastAnimationFrameEvent()); } } Loading
core/java/android/app/ActivityOptions.java +57 −9 Original line number Diff line number Diff line Loading @@ -130,6 +130,13 @@ public class ActivityOptions { */ public static final String KEY_ANIM_START_LISTENER = "android:activity.animStartListener"; /** * Callback for when the last frame of the animation is played. * @hide */ private static final String KEY_ANIMATION_FINISHED_LISTENER = "android:activity.animationFinishedListener"; /** * Descriptions of app transition animations to be played during the activity launch. */ Loading Loading @@ -198,6 +205,7 @@ public class ActivityOptions { private int mWidth; private int mHeight; private IRemoteCallback mAnimationStartedListener; private IRemoteCallback mAnimationFinishedListener; private ResultReceiver mTransitionReceiver; private boolean mIsReturning; private ArrayList<String> mSharedElementNames; Loading Loading @@ -280,16 +288,15 @@ public class ActivityOptions { return opts; } private void setOnAnimationStartedListener(Handler handler, OnAnimationStartedListener listener) { private void setOnAnimationStartedListener(final Handler handler, final OnAnimationStartedListener listener) { if (listener != null) { final Handler h = handler; final OnAnimationStartedListener finalListener = listener; mAnimationStartedListener = new IRemoteCallback.Stub() { @Override public void sendResult(Bundle data) throws RemoteException { h.post(new Runnable() { @Override public void sendResult(Bundle data) throws RemoteException { handler.post(new Runnable() { @Override public void run() { finalListener.onAnimationStarted(); listener.onAnimationStarted(); } }); } Loading @@ -306,6 +313,32 @@ public class ActivityOptions { void onAnimationStarted(); } private void setOnAnimationFinishedListener(final Handler handler, final OnAnimationFinishedListener listener) { if (listener != null) { mAnimationFinishedListener = new IRemoteCallback.Stub() { @Override public void sendResult(Bundle data) throws RemoteException { handler.post(new Runnable() { @Override public void run() { listener.onAnimationFinished(); } }); } }; } } /** * Callback for use with {@link ActivityOptions#makeThumbnailAspectScaleDownAnimation} * to find out when the given animation has drawn its last frame. * @hide */ public interface OnAnimationFinishedListener { void onAnimationFinished(); } /** * Create an ActivityOptions specifying an animation where the new * activity is scaled from a small originating area of the screen to Loading Loading @@ -523,12 +556,14 @@ public class ActivityOptions { /** @hide */ public static ActivityOptions makeThumbnailAspectScaleDownAnimation(View source, AppTransitionAnimationSpec[] specs, Handler handler, OnAnimationStartedListener listener) { OnAnimationStartedListener onAnimationStartedListener, OnAnimationFinishedListener onAnimationFinishedListener) { ActivityOptions opts = new ActivityOptions(); opts.mPackageName = source.getContext().getPackageName(); opts.mAnimationType = ANIM_THUMBNAIL_ASPECT_SCALE_DOWN; opts.mAnimSpecs = specs; opts.setOnAnimationStartedListener(handler, listener); opts.setOnAnimationStartedListener(handler, onAnimationStartedListener); opts.setOnAnimationFinishedListener(handler, onAnimationFinishedListener); return opts; } Loading Loading @@ -725,6 +760,10 @@ public class ActivityOptions { mAnimSpecs[i] = (AppTransitionAnimationSpec) specs[i]; } } if (opts.containsKey(KEY_ANIMATION_FINISHED_LISTENER)) { mAnimationFinishedListener = IRemoteCallback.Stub.asInterface( opts.getBinder(KEY_ANIMATION_FINISHED_LISTENER)); } } /** @hide */ Loading Loading @@ -799,6 +838,11 @@ public class ActivityOptions { return mAnimationStartedListener; } /** @hide */ public IRemoteCallback getAnimationFinishedListener() { return mAnimationFinishedListener; } /** @hide */ public int getExitCoordinatorKey() { return mExitCoordinatorIndex; } Loading Loading @@ -929,6 +973,7 @@ public class ActivityOptions { break; } mAnimSpecs = otherOptions.mAnimSpecs; mAnimationFinishedListener = otherOptions.mAnimationFinishedListener; } /** Loading Loading @@ -998,6 +1043,9 @@ public class ActivityOptions { if (mAnimSpecs != null) { b.putParcelableArray(KEY_ANIM_SPECS, mAnimSpecs); } if (mAnimationFinishedListener != null) { b.putBinder(KEY_ANIMATION_FINISHED_LISTENER, mAnimationFinishedListener.asBinder()); } return b; } Loading
core/java/android/view/IWindowManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -138,7 +138,7 @@ interface IWindowManager * @hide */ void overridePendingAppTransitionMultiThumb(in AppTransitionAnimationSpec[] specs, IRemoteCallback startedCallback, boolean scaleUp); IRemoteCallback startedCallback, IRemoteCallback finishedCallback, boolean scaleUp); void overridePendingAppTransitionInPlace(String packageName, int anim); void executeAppTransition(); void setAppStartingWindow(IBinder token, String pkg, int theme, Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +16 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.Bundle; import android.os.SystemClock; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.ViewStub; Loading @@ -43,6 +42,7 @@ import com.android.systemui.recents.events.activity.AppWidgetProviderChangedEven import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationStartedEvent; import com.android.systemui.recents.events.activity.HideRecentsEvent; import com.android.systemui.recents.events.activity.IterateRecentsEvent; import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent; import com.android.systemui.recents.events.activity.ToggleRecentsEvent; import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent; import com.android.systemui.recents.events.component.ScreenPinningRequestEvent; Loading Loading @@ -418,6 +418,17 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView MetricsLogger.visible(this, MetricsLogger.OVERVIEW_ACTIVITY); } @Override protected void onResume() { super.onResume(); final RecentsActivityLaunchState state = Recents.getConfiguration().getLaunchState(); if (state.startHidden) { state.startHidden = false; mRecentsView.setVisibility(View.INVISIBLE); } } @Override protected void onPause() { super.onPause(); Loading Loading @@ -645,6 +656,10 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView ctx.postAnimationTrigger.decrement(); } public final void onBusEvent(EnterRecentsWindowLastAnimationFrameEvent event) { mRecentsView.setVisibility(View.VISIBLE); } public final void onBusEvent(AppWidgetProviderChangedEvent event) { refreshSearchWidgetView(); } Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +1 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ public class RecentsActivityLaunchState { public boolean launchedFromSearchHome; public boolean launchedReuseTaskStackViews; public boolean launchedHasConfigurationChanged; public boolean startHidden; public int launchedToTaskId; public int launchedNumVisibleTasks; public int launchedNumVisibleThumbnails; Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +9 −3 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationStartedEvent; import com.android.systemui.recents.events.activity.HideRecentsEvent; import com.android.systemui.recents.events.activity.IterateRecentsEvent; import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent; import com.android.systemui.recents.events.activity.ToggleRecentsEvent; import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent; import com.android.systemui.recents.events.component.ScreenPinningRequestEvent; Loading @@ -69,7 +70,7 @@ import java.util.ArrayList; * be called remotely from the system user. */ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements ActivityOptions.OnAnimationStartedListener { implements ActivityOptions.OnAnimationStartedListener, ActivityOptions.OnAnimationFinishedListener { private final static String TAG = "RecentsImpl"; private final static boolean DEBUG = false; Loading @@ -79,7 +80,6 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub public final static String RECENTS_PACKAGE = "com.android.systemui"; public final static String RECENTS_ACTIVITY = "com.android.systemui.recents.RecentsActivity"; /** * An implementation of ITaskStackListener, that allows us to listen for changes to the system * task stacks and update recents accordingly. Loading Loading @@ -579,7 +579,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()]; specs.toArray(specsArray); return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, this); specsArray, mHandler, this, this); } else { // Update the destination rect Task toTask = new Task(); Loading Loading @@ -757,6 +757,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub launchState.launchedNumVisibleTasks = vr.numVisibleTasks; launchState.launchedNumVisibleThumbnails = vr.numVisibleThumbnails; launchState.launchedHasConfigurationChanged = false; launchState.startHidden = topTask != null && topTask.stackId == FREEFORM_WORKSPACE_STACK_ID; Intent intent = new Intent(); intent.setClassName(RECENTS_PACKAGE, RECENTS_ACTIVITY); Loading @@ -781,4 +782,9 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub EventBus.getDefault().post(new EnterRecentsWindowAnimationStartedEvent()); } } @Override public void onAnimationFinished() { EventBus.getDefault().post(new EnterRecentsWindowLastAnimationFrameEvent()); } }