Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ed9f2f9 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Adding bounce animation for affiliated tasks. (Bug 16656169)" into lmp-mr1-dev

parents 7bd54c11 044d5293
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -2279,6 +2279,20 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            return true;
        }

        case START_IN_PLACE_ANIMATION_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            final Bundle bundle;
            if (data.readInt() == 0) {
                bundle = null;
            } else {
                bundle = data.readBundle();
            }
            final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
            startInPlaceAnimationOnFrontMostApplication(options);
            reply.writeNoException();
            return true;
        }

        case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            IBinder token = data.readStrongBinder();
@@ -5297,6 +5311,24 @@ class ActivityManagerProxy implements IActivityManager
        return icon;
    }

    @Override
    public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
            throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        if (options == null) {
            data.writeInt(0);
        } else {
            data.writeInt(1);
            data.writeBundle(options.toBundle());
        }
        mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
        reply.readException();
        data.recycle();
        reply.recycle();
    }

    @Override
    public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
        Parcel data = Parcel.obtain();
+48 −0
Original line number Diff line number Diff line
@@ -62,6 +62,12 @@ public class ActivityOptions {
     */
    public static final String KEY_ANIM_EXIT_RES_ID = "android:animExitRes";

    /**
     * Custom in-place animation resource ID.
     * @hide
     */
    public static final String KEY_ANIM_IN_PLACE_RES_ID = "android:animInPlaceRes";

    /**
     * Bitmap for thumbnail animation.
     * @hide
@@ -132,11 +138,14 @@ public class ActivityOptions {
    public static final int ANIM_THUMBNAIL_ASPECT_SCALE_UP = 8;
    /** @hide */
    public static final int ANIM_THUMBNAIL_ASPECT_SCALE_DOWN = 9;
    /** @hide */
    public static final int ANIM_CUSTOM_IN_PLACE = 10;

    private String mPackageName;
    private int mAnimationType = ANIM_NONE;
    private int mCustomEnterResId;
    private int mCustomExitResId;
    private int mCustomInPlaceResId;
    private Bitmap mThumbnail;
    private int mStartX;
    private int mStartY;
@@ -198,6 +207,30 @@ public class ActivityOptions {
        return opts;
    }

    /**
     * Creates an ActivityOptions specifying a custom animation to run in place on an existing
     * activity.
     *
     * @param context Who is defining this.  This is the application that the
     * animation resources will be loaded from.
     * @param animId A resource ID of the animation resource to use for
     * the incoming activity.
     * @return Returns a new ActivityOptions object that you can use to
     * supply these options as the options Bundle when running an in-place animation.
     * @hide
     */
    public static ActivityOptions makeCustomInPlaceAnimation(Context context, int animId) {
        if (animId == 0) {
            throw new RuntimeException("You must specify a valid animation.");
        }

        ActivityOptions opts = new ActivityOptions();
        opts.mPackageName = context.getPackageName();
        opts.mAnimationType = ANIM_CUSTOM_IN_PLACE;
        opts.mCustomInPlaceResId = animId;
        return opts;
    }

    private void setOnAnimationStartedListener(Handler handler,
            OnAnimationStartedListener listener) {
        if (listener != null) {
@@ -540,6 +573,10 @@ public class ActivityOptions {
                        opts.getBinder(KEY_ANIM_START_LISTENER));
                break;

            case ANIM_CUSTOM_IN_PLACE:
                mCustomInPlaceResId = opts.getInt(KEY_ANIM_IN_PLACE_RES_ID, 0);
                break;

            case ANIM_SCALE_UP:
                mStartX = opts.getInt(KEY_ANIM_START_X, 0);
                mStartY = opts.getInt(KEY_ANIM_START_Y, 0);
@@ -591,6 +628,11 @@ public class ActivityOptions {
        return mCustomExitResId;
    }

    /** @hide */
    public int getCustomInPlaceResId() {
        return mCustomInPlaceResId;
    }

    /** @hide */
    public Bitmap getThumbnail() {
        return mThumbnail;
@@ -689,6 +731,9 @@ public class ActivityOptions {
                }
                mAnimationStartedListener = otherOptions.mAnimationStartedListener;
                break;
            case ANIM_CUSTOM_IN_PLACE:
                mCustomInPlaceResId = otherOptions.mCustomInPlaceResId;
                break;
            case ANIM_SCALE_UP:
                mStartX = otherOptions.mStartX;
                mStartY = otherOptions.mStartY;
@@ -756,6 +801,9 @@ public class ActivityOptions {
                b.putBinder(KEY_ANIM_START_LISTENER, mAnimationStartedListener
                        != null ? mAnimationStartedListener.asBinder() : null);
                break;
            case ANIM_CUSTOM_IN_PLACE:
                b.putInt(KEY_ANIM_IN_PLACE_RES_ID, mCustomInPlaceResId);
                break;
            case ANIM_SCALE_UP:
                b.putInt(KEY_ANIM_START_X, mStartX);
                b.putInt(KEY_ANIM_START_Y, mStartY);
+4 −0
Original line number Diff line number Diff line
@@ -456,6 +456,9 @@ public interface IActivityManager extends IInterface {
            throws RemoteException;
    public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException;

    public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions opts)
            throws RemoteException;

    public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException;
    public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException;
    public void backgroundResourcesReleased(IBinder token) throws RemoteException;
@@ -781,4 +784,5 @@ public interface IActivityManager extends IInterface {
    int BOOT_ANIMATION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+237;
    int GET_TASK_DESCRIPTION_ICON_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+238;
    int LAUNCH_ASSIST_INTENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+239;
    int START_IN_PLACE_ANIMATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+240;
}
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ interface IWindowManager
    void overridePendingAppTransitionAspectScaledThumb(in Bitmap srcThumb, int startX,
            int startY, int targetWidth, int targetHeight, IRemoteCallback startedCallback,
            boolean scaleUp);
    void overridePendingAppTransitionInPlace(String packageName, int anim);
    void executeAppTransition();
    void setAppStartingWindow(IBinder token, String pkg, int theme,
            in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
+14 −25
Original line number Diff line number Diff line
@@ -22,38 +22,27 @@

    <alpha android:fromAlpha="1.0" android:toAlpha="0.6"
        android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
        android:interpolator="@interpolator/accelerate_cubic"
        android:duration="133"/>
        android:interpolator="@interpolator/linear_out_slow_in"
        android:duration="417"/>

    <translate android:fromYDelta="0" android:toYDelta="10%"
        android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
        android:interpolator="@interpolator/accelerate_cubic"
        android:duration="350"/>

    <scale android:fromXScale="1.0" android:toXScale="0.9"
        android:fromYScale="1.0" android:toYScale="0.9"
    <scale android:fromXScale="1.0" android:toXScale="0.918"
        android:fromYScale="1.0" android:toYScale="0.918"
        android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
        android:pivotX="50%p" android:pivotY="50%p"
        android:interpolator="@interpolator/fast_out_slow_in"
        android:duration="350" />
        android:interpolator="@interpolator/launch_task_behind_source_scale_1"
        android:duration="417" />

    <alpha android:fromAlpha="1.0" android:toAlpha="1.6666666666"
        android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
        android:interpolator="@interpolator/decelerate_cubic"
        android:startOffset="433"
        android:duration="133"/>

    <translate android:fromYDelta="0%" android:toYDelta="-8.8888888888%"
        android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
        android:interpolator="@interpolator/decelerate_cubic"
        android:startOffset="433"
        android:duration="350"/>
        android:interpolator="@interpolator/linear"
        android:startOffset="500"
        android:duration="167"/>

    <scale android:fromXScale="1.0" android:toXScale="1.1111111111"
        android:fromYScale="1.0" android:toYScale="1.1111111111"
    <scale android:fromXScale="1.0" android:toXScale="1.08932461873638"
        android:fromYScale="1.0" android:toYScale="1.08932461873638"
        android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
        android:pivotX="50%p" android:pivotY="50%p"
        android:interpolator="@interpolator/decelerate_cubic"
        android:startOffset="433"
        android:duration="350" />
        android:interpolator="@interpolator/launch_task_behind_source_scale_2"
        android:startOffset="500"
        android:duration="317" />
</set>
 No newline at end of file
Loading