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

Commit 7a2195cd authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Start using the new activity options argument.

New class lets you make an options bundle defining a custom animation,
as an alternative to Activity.overridePendingTransition().

Change-Id: I8e209bf52398a98ab9f1bcafa1ec0a580dae57c0
parent f6b8f7b3
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2864,6 +2864,12 @@ package android.app {
    field public android.content.ComponentName topActivity;
  }
  public class ActivityOptions {
    method public void join(android.app.ActivityOptions);
    method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int);
    method public android.os.Bundle toBundle();
  }
  public class AlarmManager {
    method public void cancel(android.app.PendingIntent);
    method public void set(int, long, android.app.PendingIntent);
@@ -3728,7 +3734,9 @@ package android.app {
    method public void cancel();
    method public int describeContents();
    method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent[], int);
    method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent[], int, android.os.Bundle);
    method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int);
    method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle);
    method public static android.app.PendingIntent getBroadcast(android.content.Context, int, android.content.Intent, int);
    method public android.content.IntentSender getIntentSender();
    method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int);
+31 −12
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.Resources.Theme;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -55,7 +54,6 @@ import android.util.AttributeSet;
import android.util.EventLog;
import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.ActionMode;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
@@ -3208,7 +3206,8 @@ public class Activity extends ContextThemeWrapper
     * @param requestCode If >= 0, this code will be returned in
     *                    onActivityResult() when the activity exits.
     * @param options Additional options for how the Activity should be started.
     * May be null if there are no options.
     * See {@link android.content.Context#startActivity(Intent, Bundle)
     * Context.startActivity(Intent, Bundle)} for more details.
     *
     * @throws android.content.ActivityNotFoundException
     *
@@ -3288,7 +3287,10 @@ public class Activity extends ContextThemeWrapper
     * <var>flagsMask</var>
     * @param extraFlags Always set to 0.
     * @param options Additional options for how the Activity should be started.
     * May be null if there are no options.
     * See {@link android.content.Context#startActivity(Intent, Bundle)
     * Context.startActivity(Intent, Bundle)} for more details.  If options
     * have also been supplied by the IntentSender, options given here will
     * override any that conflict with those given by the IntentSender.
     */
    public void startIntentSenderForResult(IntentSender intent, int requestCode,
            Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
@@ -3369,7 +3371,8 @@ public class Activity extends ContextThemeWrapper
     * 
     * @param intent The intent to start. 
     * @param options Additional options for how the Activity should be started.
     * May be null if there are no options.
     * See {@link android.content.Context#startActivity(Intent, Bundle)
     * Context.startActivity(Intent, Bundle)} for more details.
     * 
     * @throws android.content.ActivityNotFoundException
     *
@@ -3417,7 +3420,8 @@ public class Activity extends ContextThemeWrapper
     *
     * @param intents The intents to start.
     * @param options Additional options for how the Activity should be started.
     * May be null if there are no options.
     * See {@link android.content.Context#startActivity(Intent, Bundle)
     * Context.startActivity(Intent, Bundle)} for more details.
     *
     * @throws android.content.ActivityNotFoundException
     *
@@ -3465,7 +3469,10 @@ public class Activity extends ContextThemeWrapper
     * <var>flagsMask</var>
     * @param extraFlags Always set to 0.
     * @param options Additional options for how the Activity should be started.
     * May be null if there are no options.
     * See {@link android.content.Context#startActivity(Intent, Bundle)
     * Context.startActivity(Intent, Bundle)} for more details.  If options
     * have also been supplied by the IntentSender, options given here will
     * override any that conflict with those given by the IntentSender.
     */
    public void startIntentSender(IntentSender intent,
            Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
@@ -3521,7 +3528,8 @@ public class Activity extends ContextThemeWrapper
     *         onActivityResult() when the activity exits, as described in
     *         {@link #startActivityForResult}.
     * @param options Additional options for how the Activity should be started.
     * May be null if there are no options.
     * See {@link android.content.Context#startActivity(Intent, Bundle)
     * Context.startActivity(Intent, Bundle)} for more details.
     * 
     * @return If a new activity was launched then true is returned; otherwise
     *         false is returned and you must handle the Intent yourself.
@@ -3592,7 +3600,8 @@ public class Activity extends ContextThemeWrapper
     * your own activity; the only changes you can make are to the extras
     * inside of it.
     * @param options Additional options for how the Activity should be started.
     * May be null if there are no options.
     * See {@link android.content.Context#startActivity(Intent, Bundle)
     * Context.startActivity(Intent, Bundle)} for more details.
     * 
     * @return Returns a boolean indicating whether there was another Activity
     * to start: true if there was a next activity to start, false if there
@@ -3644,7 +3653,8 @@ public class Activity extends ContextThemeWrapper
     * @param intent The intent to start.
     * @param requestCode Reply request code.  < 0 if reply is not requested.
     * @param options Additional options for how the Activity should be started.
     * May be null if there are no options.
     * See {@link android.content.Context#startActivity(Intent, Bundle)
     * Context.startActivity(Intent, Bundle)} for more details.
     * 
     * @throws android.content.ActivityNotFoundException
     * 
@@ -3694,7 +3704,8 @@ public class Activity extends ContextThemeWrapper
     * @param intent The intent to start.
     * @param requestCode Reply request code.  < 0 if reply is not requested. 
     * @param options Additional options for how the Activity should be started.
     * May be null if there are no options.
     * See {@link android.content.Context#startActivity(Intent, Bundle)
     * Context.startActivity(Intent, Bundle)} for more details.
     * 
     * @throws android.content.ActivityNotFoundException
     * 
@@ -3744,6 +3755,14 @@ 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.
     *
     * <p>As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN} an alternative
     * to using this with starting activities is to supply the desired animation
     * information through a {@link ActivityOptions} bundle to
     * {@link #startActivity(Intent, Bundle) or a related function.  This allows
     * you to specify a custom animation even when starting an activity from
     * outside the context of the current top activity.
     *
     * @param enterAnim A resource ID of the animation resource to use for
     * the incoming activity.  Use 0 for no animation.
     * @param exitAnim A resource ID of the animation resource to use for
@@ -4065,7 +4084,7 @@ public class Activity extends ContextThemeWrapper
                ActivityManagerNative.getDefault().getIntentSender(
                        ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName,
                        mParent == null ? mToken : mParent.mToken,
                        mEmbeddedID, requestCode, new Intent[] { data }, null, flags);
                        mEmbeddedID, requestCode, new Intent[] { data }, null, flags, null);
            return target != null ? new PendingIntent(target) : null;
        } catch (RemoteException e) {
            // Empty
+11 −3
Original line number Diff line number Diff line
@@ -835,9 +835,11 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
                requestResolvedTypes = null;
            }
            int fl = data.readInt();
            Bundle options = data.readInt() != 0
                    ? Bundle.CREATOR.createFromParcel(data) : null;
            IIntentSender res = getIntentSender(type, packageName, token,
                    resultWho, requestCode, requestIntents,
                    requestResolvedTypes, fl);
                    requestResolvedTypes, fl, options);
            reply.writeNoException();
            reply.writeStrongBinder(res != null ? res.asBinder() : null);
            return true;
@@ -2607,8 +2609,8 @@ class ActivityManagerProxy implements IActivityManager
    }
    public IIntentSender getIntentSender(int type,
            String packageName, IBinder token, String resultWho,
            int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
            throws RemoteException {
            int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
            Bundle options) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
@@ -2625,6 +2627,12 @@ class ActivityManagerProxy implements IActivityManager
            data.writeInt(0);
        }
        data.writeInt(flags);
        if (options != null) {
            data.writeInt(1);
            options.writeToParcel(data, 0);
        } else {
            data.writeInt(0);
        }
        mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
        reply.readException();
        IIntentSender res = IIntentSender.Stub.asInterface(
+7 −0
Original line number Diff line number Diff line
@@ -965,6 +965,8 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
    /**
     * Call {@link Activity#startActivity(Intent)} on the fragment's
     * containing Activity.
     *
     * @param intent The intent to start.
     */
    public void startActivity(Intent intent) {
        startActivity(intent, null);
@@ -973,6 +975,11 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
    /**
     * Call {@link Activity#startActivity(Intent, Bundle)} on the fragment's
     * containing Activity.
     *
     * @param intent The intent to start.
     * @param options Additional options for how the Activity should be started.
     * See {@link android.content.Context#startActivity(Intent, Bundle)
     * Context.startActivity(Intent, Bundle)} for more details.
     */
    public void startActivity(Intent intent, Bundle options) {
        if (mActivity == null) {
+1 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ public interface IActivityManager extends IInterface {
    public IIntentSender getIntentSender(int type,
            String packageName, IBinder token, String resultWho,
            int requestCode, Intent[] intents, String[] resolvedTypes,
            int flags) throws RemoteException;
            int flags, Bundle options) throws RemoteException;
    public void cancelIntentSender(IIntentSender sender) throws RemoteException;
    public boolean clearApplicationUserData(final String packageName,
            final IPackageDataObserver observer, int userId) throws RemoteException;
Loading