Loading core/java/android/app/ActivityOptions.java +60 −14 Original line number Diff line number Diff line Loading @@ -127,14 +127,55 @@ public class ActivityOptions { */ public static ActivityOptions makeCustomAnimation(Context context, int enterResId, int exitResId) { return makeCustomAnimation(context, enterResId, exitResId, null, null); } /** * Create an ActivityOptions specifying a custom animation to run when * the activity is displayed. * * @param context Who is defining this. This is the application that the * animation resources will be loaded from. * @param enterResId A resource ID of the animation resource to use for * the incoming activity. Use 0 for no animation. * @param exitResId A resource ID of the animation resource to use for * the outgoing activity. Use 0 for no animation. * @param handler If <var>listener</var> is non-null this must be a valid * Handler on which to dispatch the callback; otherwise it should be null. * @param listener Optional OnAnimationStartedListener to find out when the * requested animation has started running. If for some reason the animation * is not executed, the callback will happen immediately. * @return Returns a new ActivityOptions object that you can use to * supply these options as the options Bundle when starting an activity. * @hide */ public static ActivityOptions makeCustomAnimation(Context context, int enterResId, int exitResId, Handler handler, OnAnimationStartedListener listener) { ActivityOptions opts = new ActivityOptions(); opts.mPackageName = context.getPackageName(); opts.mAnimationType = ANIM_CUSTOM; opts.mCustomEnterResId = enterResId; opts.mCustomExitResId = exitResId; opts.setListener(handler, listener); return opts; } private void setListener(Handler handler, 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 run() { finalListener.onAnimationStarted(); } }); } }; } } /** * Callback for use with {@link ActivityOptions#makeThumbnailScaleUpAnimation} * to find out when the given animation has started running. Loading Loading @@ -258,19 +299,7 @@ public class ActivityOptions { source.getLocationOnScreen(pts); opts.mStartX = pts[0] + startX; opts.mStartY = pts[1] + startY; if (listener != null) { final Handler h = source.getHandler(); final OnAnimationStartedListener finalListener = listener; opts.mAnimationStartedListener = new IRemoteCallback.Stub() { @Override public void sendResult(Bundle data) throws RemoteException { h.post(new Runnable() { @Override public void run() { finalListener.onAnimationStarted(); } }); } }; } opts.setListener(source.getHandler(), listener); return opts; } Loading @@ -284,6 +313,8 @@ public class ActivityOptions { if (mAnimationType == ANIM_CUSTOM) { mCustomEnterResId = opts.getInt(KEY_ANIM_ENTER_RES_ID, 0); mCustomExitResId = opts.getInt(KEY_ANIM_EXIT_RES_ID, 0); mAnimationStartedListener = IRemoteCallback.Stub.asInterface( opts.getIBinder(KEY_ANIM_START_LISTENER)); } else if (mAnimationType == ANIM_SCALE_UP) { mStartX = opts.getInt(KEY_ANIM_START_X, 0); mStartY = opts.getInt(KEY_ANIM_START_Y, 0); Loading Loading @@ -381,7 +412,13 @@ public class ActivityOptions { mCustomEnterResId = otherOptions.mCustomEnterResId; mCustomExitResId = otherOptions.mCustomExitResId; mThumbnail = null; mAnimationStartedListener = null; if (otherOptions.mAnimationStartedListener != null) { try { otherOptions.mAnimationStartedListener.sendResult(null); } catch (RemoteException e) { } } mAnimationStartedListener = otherOptions.mAnimationStartedListener; break; case ANIM_SCALE_UP: mAnimationType = otherOptions.mAnimationType; Loading @@ -389,6 +426,13 @@ public class ActivityOptions { mStartY = otherOptions.mStartY; mStartWidth = otherOptions.mStartWidth; mStartHeight = otherOptions.mStartHeight; if (otherOptions.mAnimationStartedListener != null) { try { otherOptions.mAnimationStartedListener.sendResult(null); } catch (RemoteException e) { } } mAnimationStartedListener = null; break; case ANIM_THUMBNAIL: case ANIM_THUMBNAIL_DELAYED: Loading Loading @@ -425,6 +469,8 @@ public class ActivityOptions { b.putInt(KEY_ANIM_TYPE, mAnimationType); b.putInt(KEY_ANIM_ENTER_RES_ID, mCustomEnterResId); b.putInt(KEY_ANIM_EXIT_RES_ID, mCustomExitResId); b.putIBinder(KEY_ANIM_START_LISTENER, mAnimationStartedListener != null ? mAnimationStartedListener.asBinder() : null); break; case ANIM_SCALE_UP: b.putInt(KEY_ANIM_TYPE, mAnimationType); Loading core/java/android/view/IWindowManager.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,8 @@ interface IWindowManager void setFocusedApp(IBinder token, boolean moveFocusNow); void prepareAppTransition(int transit, boolean alwaysKeepCurrent); int getPendingAppTransition(); void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim); void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim, IRemoteCallback startedCallback); void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth, int startHeight); void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY, Loading packages/SystemUI/res/anim/search_launch_enter.xml +2 −2 Original line number Diff line number Diff line Loading @@ -22,10 +22,10 @@ <alpha android:fromAlpha="0" android:toAlpha="1.0" android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" android:interpolator="@android:interpolator/decelerate_quad" android:interpolator="@android:interpolator/decelerate_cubic" android:duration="300"/> <translate android:fromYDelta="200" android:toYDelta="0" <translate android:fromYDelta="100%" android:toYDelta="0" android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" android:interpolator="@android:interpolator/decelerate_cubic" android:duration="300" /> Loading packages/SystemUI/src/com/android/systemui/SearchPanelView.java +19 −14 Original line number Diff line number Diff line Loading @@ -46,8 +46,8 @@ import com.android.systemui.statusbar.tablet.StatusBarPanel; import com.android.systemui.statusbar.tablet.TabletStatusBar; public class SearchPanelView extends FrameLayout implements StatusBarPanel { private static final int SEARCH_PANEL_HOLD_DURATION = 500; StatusBarPanel, ActivityOptions.OnAnimationStartedListener { private static final int SEARCH_PANEL_HOLD_DURATION = 0; static final String TAG = "SearchPanelView"; static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false; private static final String ASSIST_ICON_METADATA_NAME = Loading Loading @@ -115,18 +115,18 @@ public class SearchPanelView extends FrameLayout implements if (intent == null) return; try { ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, R.anim.search_launch_enter, R.anim.search_launch_exit); R.anim.search_launch_enter, R.anim.search_launch_exit, getHandler(), this); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent, opts.toBundle()); } catch (ActivityNotFoundException e) { Slog.w(TAG, "Activity not found for " + intent.getAction()); onAnimationStarted(); } } final MultiWaveView.OnTriggerListener mMultiWaveViewListener = new MultiWaveView.OnTriggerListener() { private boolean mWaitingForLaunch; class MultiWaveTriggerListener implements MultiWaveView.OnTriggerListener { boolean mWaitingForLaunch; public void onGrabbed(View v, int handle) { } Loading @@ -147,19 +147,24 @@ public class SearchPanelView extends FrameLayout implements mWaitingForLaunch = true; startAssistActivity(); vibrate(); postDelayed(new Runnable() { public void run() { mWaitingForLaunch = false; mBar.hideSearchPanel(); } }, SEARCH_PANEL_HOLD_DURATION); break; } } public void onFinishFinalAnimation() { } }; } final MultiWaveTriggerListener mMultiWaveViewListener = new MultiWaveTriggerListener(); @Override public void onAnimationStarted() { postDelayed(new Runnable() { public void run() { mMultiWaveViewListener.mWaitingForLaunch = false; mBar.hideSearchPanel(); } }, SEARCH_PANEL_HOLD_DURATION); } @Override protected void onFinishInflate() { Loading services/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2804,7 +2804,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (self.state == ActivityState.RESUMED || self.state == ActivityState.PAUSING) { mWindowManager.overridePendingAppTransition(packageName, enterAnim, exitAnim); enterAnim, exitAnim, null); } Binder.restoreCallingIdentity(origId); Loading Loading
core/java/android/app/ActivityOptions.java +60 −14 Original line number Diff line number Diff line Loading @@ -127,14 +127,55 @@ public class ActivityOptions { */ public static ActivityOptions makeCustomAnimation(Context context, int enterResId, int exitResId) { return makeCustomAnimation(context, enterResId, exitResId, null, null); } /** * Create an ActivityOptions specifying a custom animation to run when * the activity is displayed. * * @param context Who is defining this. This is the application that the * animation resources will be loaded from. * @param enterResId A resource ID of the animation resource to use for * the incoming activity. Use 0 for no animation. * @param exitResId A resource ID of the animation resource to use for * the outgoing activity. Use 0 for no animation. * @param handler If <var>listener</var> is non-null this must be a valid * Handler on which to dispatch the callback; otherwise it should be null. * @param listener Optional OnAnimationStartedListener to find out when the * requested animation has started running. If for some reason the animation * is not executed, the callback will happen immediately. * @return Returns a new ActivityOptions object that you can use to * supply these options as the options Bundle when starting an activity. * @hide */ public static ActivityOptions makeCustomAnimation(Context context, int enterResId, int exitResId, Handler handler, OnAnimationStartedListener listener) { ActivityOptions opts = new ActivityOptions(); opts.mPackageName = context.getPackageName(); opts.mAnimationType = ANIM_CUSTOM; opts.mCustomEnterResId = enterResId; opts.mCustomExitResId = exitResId; opts.setListener(handler, listener); return opts; } private void setListener(Handler handler, 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 run() { finalListener.onAnimationStarted(); } }); } }; } } /** * Callback for use with {@link ActivityOptions#makeThumbnailScaleUpAnimation} * to find out when the given animation has started running. Loading Loading @@ -258,19 +299,7 @@ public class ActivityOptions { source.getLocationOnScreen(pts); opts.mStartX = pts[0] + startX; opts.mStartY = pts[1] + startY; if (listener != null) { final Handler h = source.getHandler(); final OnAnimationStartedListener finalListener = listener; opts.mAnimationStartedListener = new IRemoteCallback.Stub() { @Override public void sendResult(Bundle data) throws RemoteException { h.post(new Runnable() { @Override public void run() { finalListener.onAnimationStarted(); } }); } }; } opts.setListener(source.getHandler(), listener); return opts; } Loading @@ -284,6 +313,8 @@ public class ActivityOptions { if (mAnimationType == ANIM_CUSTOM) { mCustomEnterResId = opts.getInt(KEY_ANIM_ENTER_RES_ID, 0); mCustomExitResId = opts.getInt(KEY_ANIM_EXIT_RES_ID, 0); mAnimationStartedListener = IRemoteCallback.Stub.asInterface( opts.getIBinder(KEY_ANIM_START_LISTENER)); } else if (mAnimationType == ANIM_SCALE_UP) { mStartX = opts.getInt(KEY_ANIM_START_X, 0); mStartY = opts.getInt(KEY_ANIM_START_Y, 0); Loading Loading @@ -381,7 +412,13 @@ public class ActivityOptions { mCustomEnterResId = otherOptions.mCustomEnterResId; mCustomExitResId = otherOptions.mCustomExitResId; mThumbnail = null; mAnimationStartedListener = null; if (otherOptions.mAnimationStartedListener != null) { try { otherOptions.mAnimationStartedListener.sendResult(null); } catch (RemoteException e) { } } mAnimationStartedListener = otherOptions.mAnimationStartedListener; break; case ANIM_SCALE_UP: mAnimationType = otherOptions.mAnimationType; Loading @@ -389,6 +426,13 @@ public class ActivityOptions { mStartY = otherOptions.mStartY; mStartWidth = otherOptions.mStartWidth; mStartHeight = otherOptions.mStartHeight; if (otherOptions.mAnimationStartedListener != null) { try { otherOptions.mAnimationStartedListener.sendResult(null); } catch (RemoteException e) { } } mAnimationStartedListener = null; break; case ANIM_THUMBNAIL: case ANIM_THUMBNAIL_DELAYED: Loading Loading @@ -425,6 +469,8 @@ public class ActivityOptions { b.putInt(KEY_ANIM_TYPE, mAnimationType); b.putInt(KEY_ANIM_ENTER_RES_ID, mCustomEnterResId); b.putInt(KEY_ANIM_EXIT_RES_ID, mCustomExitResId); b.putIBinder(KEY_ANIM_START_LISTENER, mAnimationStartedListener != null ? mAnimationStartedListener.asBinder() : null); break; case ANIM_SCALE_UP: b.putInt(KEY_ANIM_TYPE, mAnimationType); Loading
core/java/android/view/IWindowManager.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,8 @@ interface IWindowManager void setFocusedApp(IBinder token, boolean moveFocusNow); void prepareAppTransition(int transit, boolean alwaysKeepCurrent); int getPendingAppTransition(); void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim); void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim, IRemoteCallback startedCallback); void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth, int startHeight); void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY, Loading
packages/SystemUI/res/anim/search_launch_enter.xml +2 −2 Original line number Diff line number Diff line Loading @@ -22,10 +22,10 @@ <alpha android:fromAlpha="0" android:toAlpha="1.0" android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" android:interpolator="@android:interpolator/decelerate_quad" android:interpolator="@android:interpolator/decelerate_cubic" android:duration="300"/> <translate android:fromYDelta="200" android:toYDelta="0" <translate android:fromYDelta="100%" android:toYDelta="0" android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" android:interpolator="@android:interpolator/decelerate_cubic" android:duration="300" /> Loading
packages/SystemUI/src/com/android/systemui/SearchPanelView.java +19 −14 Original line number Diff line number Diff line Loading @@ -46,8 +46,8 @@ import com.android.systemui.statusbar.tablet.StatusBarPanel; import com.android.systemui.statusbar.tablet.TabletStatusBar; public class SearchPanelView extends FrameLayout implements StatusBarPanel { private static final int SEARCH_PANEL_HOLD_DURATION = 500; StatusBarPanel, ActivityOptions.OnAnimationStartedListener { private static final int SEARCH_PANEL_HOLD_DURATION = 0; static final String TAG = "SearchPanelView"; static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false; private static final String ASSIST_ICON_METADATA_NAME = Loading Loading @@ -115,18 +115,18 @@ public class SearchPanelView extends FrameLayout implements if (intent == null) return; try { ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, R.anim.search_launch_enter, R.anim.search_launch_exit); R.anim.search_launch_enter, R.anim.search_launch_exit, getHandler(), this); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent, opts.toBundle()); } catch (ActivityNotFoundException e) { Slog.w(TAG, "Activity not found for " + intent.getAction()); onAnimationStarted(); } } final MultiWaveView.OnTriggerListener mMultiWaveViewListener = new MultiWaveView.OnTriggerListener() { private boolean mWaitingForLaunch; class MultiWaveTriggerListener implements MultiWaveView.OnTriggerListener { boolean mWaitingForLaunch; public void onGrabbed(View v, int handle) { } Loading @@ -147,19 +147,24 @@ public class SearchPanelView extends FrameLayout implements mWaitingForLaunch = true; startAssistActivity(); vibrate(); postDelayed(new Runnable() { public void run() { mWaitingForLaunch = false; mBar.hideSearchPanel(); } }, SEARCH_PANEL_HOLD_DURATION); break; } } public void onFinishFinalAnimation() { } }; } final MultiWaveTriggerListener mMultiWaveViewListener = new MultiWaveTriggerListener(); @Override public void onAnimationStarted() { postDelayed(new Runnable() { public void run() { mMultiWaveViewListener.mWaitingForLaunch = false; mBar.hideSearchPanel(); } }, SEARCH_PANEL_HOLD_DURATION); } @Override protected void onFinishInflate() { Loading
services/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2804,7 +2804,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (self.state == ActivityState.RESUMED || self.state == ActivityState.PAUSING) { mWindowManager.overridePendingAppTransition(packageName, enterAnim, exitAnim); enterAnim, exitAnim, null); } Binder.restoreCallingIdentity(origId); Loading