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

Commit 468f7da7 authored by George Mount's avatar George Mount Committed by Android (Google) Code Review
Browse files

Merge "Introduce onNewActivityOptions for return activity"

parents ac5550fe eb8abf72
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -5284,6 +5284,14 @@ public class Activity extends ContextThemeWrapper
        }
    }

    /** @hide */
    public void onNewActivityOptions(ActivityOptions options) {
        mActivityTransitionState.setEnterActivityOptions(this, options);
        if (!mStopped) {
            mActivityTransitionState.enterReady(this);
        }
    }

    /**
     * Retrieve the ActivityOptions passed in from the launching activity or passed back
     * from an activity launched by this activity in its call to {@link
+19 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.Log;
import android.util.LogPrinter;
import android.util.Pair;
import android.util.PrintWriterPrinter;
import android.util.Slog;
import android.util.SuperNotCalledException;
@@ -1113,6 +1114,11 @@ public final class ActivityThread {
            sendMessage(H.TRANSLUCENT_CONVERSION_COMPLETE, token, drawComplete ? 1 : 0);
        }

        public void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options) {
            sendMessage(H.ON_NEW_ACTIVITY_OPTIONS,
                    new Pair<IBinder, ActivityOptions>(token, options));
        }

        public void setProcessState(int state) {
            updateProcessState(state, true);
        }
@@ -1196,6 +1202,7 @@ public final class ActivityThread {
        public static final int REQUEST_ASSIST_CONTEXT_EXTRAS = 143;
        public static final int TRANSLUCENT_CONVERSION_COMPLETE = 144;
        public static final int INSTALL_PROVIDER        = 145;
        public static final int ON_NEW_ACTIVITY_OPTIONS = 146;

        String codeToString(int code) {
            if (DEBUG_MESSAGES) {
@@ -1245,6 +1252,7 @@ public final class ActivityThread {
                    case REQUEST_ASSIST_CONTEXT_EXTRAS: return "REQUEST_ASSIST_CONTEXT_EXTRAS";
                    case TRANSLUCENT_CONVERSION_COMPLETE: return "TRANSLUCENT_CONVERSION_COMPLETE";
                    case INSTALL_PROVIDER: return "INSTALL_PROVIDER";
                    case ON_NEW_ACTIVITY_OPTIONS: return "ON_NEW_ACTIVITY_OPTIONS";
                }
            }
            return Integer.toString(code);
@@ -1459,6 +1467,10 @@ public final class ActivityThread {
                case INSTALL_PROVIDER:
                    handleInstallProvider((ProviderInfo) msg.obj);
                    break;
                case ON_NEW_ACTIVITY_OPTIONS:
                    Pair<IBinder, ActivityOptions> pair = (Pair<IBinder, ActivityOptions>) msg.obj;
                    onNewActivityOptions(pair.first, pair.second);
                    break;
            }
            if (DEBUG_MESSAGES) Slog.v(TAG, "<<< done: " + codeToString(msg.what));
        }
@@ -2435,6 +2447,13 @@ public final class ActivityThread {
        }
    }

    public void onNewActivityOptions(IBinder token, ActivityOptions options) {
        ActivityClientRecord r = mActivities.get(token);
        if (r != null) {
            r.activity.onNewActivityOptions(options);
        }
    }

    public void handleInstallProvider(ProviderInfo info) {
        installContentProviders(mInitialApplication, Lists.newArrayList(info));
    }
+24 −1
Original line number Diff line number Diff line
@@ -611,6 +611,16 @@ public abstract class ApplicationThreadNative extends Binder
            return true;
        }

        case SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION:
        {
            data.enforceInterface(IApplicationThread.descriptor);
            IBinder token = data.readStrongBinder();
            ActivityOptions options = new ActivityOptions(data.readBundle());
            scheduleOnNewActivityOptions(token, options);
            reply.writeNoException();
            return true;
        }

        case SET_PROCESS_STATE_TRANSACTION:
        {
            data.enforceInterface(IApplicationThread.descriptor);
@@ -1251,7 +1261,20 @@ class ApplicationThreadProxy implements IApplicationThread {
        data.writeInterfaceToken(IApplicationThread.descriptor);
        data.writeStrongBinder(token);
        data.writeInt(timeout ? 1 : 0);
        mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
        mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null,
                IBinder.FLAG_ONEWAY);
        data.recycle();
    }

    @Override
    public void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options)
            throws RemoteException {
        Parcel data = Parcel.obtain();
        data.writeInterfaceToken(IApplicationThread.descriptor);
        data.writeStrongBinder(token);
        data.writeBundle(options == null ? null : options.toBundle());
        mRemote.transact(SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION, data, null,
                IBinder.FLAG_ONEWAY);
        data.recycle();
    }

+3 −1
Original line number Diff line number Diff line
@@ -140,6 +140,8 @@ public interface IApplicationThread extends IInterface {
            throws RemoteException;
    void scheduleTranslucentConversionComplete(IBinder token, boolean timeout)
            throws RemoteException;
    void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options)
            throws RemoteException;
    void setProcessState(int state) throws RemoteException;
    void scheduleInstallProvider(ProviderInfo provider) throws RemoteException;
    void updateTimePrefs(boolean is24Hour) throws RemoteException;
@@ -176,7 +178,7 @@ public interface IApplicationThread extends IInterface {
    int SET_SCHEDULING_GROUP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+28;
    int SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+29;
    int SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+30;

    int SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+31;
    int SCHEDULE_SUICIDE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+32;
    int DISPATCH_PACKAGE_BROADCAST_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+33;
    int SCHEDULE_CRASH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+34;
+4 −1
Original line number Diff line number Diff line
@@ -9370,9 +9370,12 @@ public final class ActivityManagerService extends ActivityManagerNative
                    mWindowManager.setAppFullscreen(token, false);
                    mStackSupervisor.ensureActivitiesVisibleLocked(null, 0);
                    return true;
                }
                } else {
                    r.task.stack.mReturningActivityOptions = options;
                    mStackSupervisor.ensureActivitiesVisibleLocked(null, 0);
                    return false;
                }
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
Loading