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

Commit e1fab7b1 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Send ActivityOptions to client"

parents 3544db0d e4b3ff67
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -890,6 +890,9 @@ public class Activity extends ContextThemeWrapper
    @UnsupportedAppUsage
    final FragmentController mFragments = FragmentController.createController(new HostCallbacks());

    /** The options for scene transition. */
    ActivityOptions mPendingOptions;

    private static final class ManagedCursor {
        ManagedCursor(Cursor cursor) {
            mCursor = cursor;
@@ -7258,7 +7261,7 @@ public class Activity extends ContextThemeWrapper
    }

    /**
     * Retrieve the ActivityOptions passed in from the launching activity or passed back
     * Takes the ActivityOptions passed in from the launching activity or passed back
     * from an activity launched by this activity in its call to {@link
     * #convertToTranslucent(TranslucentConversionListener, ActivityOptions)}
     *
@@ -7267,7 +7270,10 @@ public class Activity extends ContextThemeWrapper
     */
    @UnsupportedAppUsage
    ActivityOptions getActivityOptions() {
        return ActivityOptions.fromBundle(ActivityClient.getInstance().getActivityOptions(mToken));
        final ActivityOptions options = mPendingOptions;
        // The option only applies once.
        mPendingOptions = null;
        return options;
    }

    /**
+0 −8
Original line number Diff line number Diff line
@@ -237,14 +237,6 @@ public class ActivityClient {
        }
    }

    Bundle getActivityOptions(IBinder token) {
        try {
            return getActivityClientController().getActivityOptions(token);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    public void setRequestedOrientation(IBinder token, int requestedOrientation) {
        try {
            getActivityClientController().setRequestedOrientation(token, requestedOrientation);
+14 −3
Original line number Diff line number Diff line
@@ -567,6 +567,9 @@ public final class ActivityThread extends ClientTransactionHandler {
        @UnsupportedAppUsage
        boolean mPreserveWindow;

        /** The options for scene transition. */
        ActivityOptions mActivityOptions;

        /**
         * If non-null, the activity is launching with a specified rotation, the adjustments should
         * be consumed before activity creation.
@@ -587,8 +590,8 @@ public final class ActivityThread extends ClientTransactionHandler {
                ActivityInfo info, Configuration overrideConfig, CompatibilityInfo compatInfo,
                String referrer, IVoiceInteractor voiceInteractor, Bundle state,
                PersistableBundle persistentState, List<ResultInfo> pendingResults,
                List<ReferrerIntent> pendingNewIntents, boolean isForward,
                ProfilerInfo profilerInfo, ClientTransactionHandler client,
                List<ReferrerIntent> pendingNewIntents, ActivityOptions activityOptions,
                boolean isForward, ProfilerInfo profilerInfo, ClientTransactionHandler client,
                IBinder assistToken, FixedRotationAdjustments fixedRotationAdjustments) {
            this.token = token;
            this.assistToken = assistToken;
@@ -607,6 +610,7 @@ public final class ActivityThread extends ClientTransactionHandler {
            this.overrideConfig = overrideConfig;
            this.packageInfo = client.getPackageInfoNoCheck(activityInfo.applicationInfo,
                    compatInfo);
            mActivityOptions = activityOptions;
            mPendingFixedRotationAdjustments = fixedRotationAdjustments;
            init();
        }
@@ -3469,6 +3473,10 @@ public final class ActivityThread extends ClientTransactionHandler {
                    activity.setTheme(theme);
                }

                if (r.mActivityOptions != null) {
                    activity.mPendingOptions = r.mActivityOptions;
                    r.mActivityOptions = null;
                }
                activity.mCalled = false;
                if (r.isPersistable()) {
                    mInstrumentation.callActivityOnCreate(activity, r.state, r.persistentState);
@@ -3509,7 +3517,7 @@ public final class ActivityThread extends ClientTransactionHandler {

    @Override
    public void handleStartActivity(ActivityClientRecord r,
            PendingTransactionActions pendingActions) {
            PendingTransactionActions pendingActions, ActivityOptions activityOptions) {
        final Activity activity = r.activity;
        if (!r.stopped) {
            throw new IllegalStateException("Can't start activity that is not stopped.");
@@ -3520,6 +3528,9 @@ public final class ActivityThread extends ClientTransactionHandler {
        }

        unscheduleGcIdler();
        if (activityOptions != null) {
            activity.mPendingOptions = activityOptions;
        }

        // Start
        activity.performStart("handleStartActivity");
+1 −1
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ public abstract class ClientTransactionHandler {

    /** Perform activity start. */
    public abstract void handleStartActivity(@NonNull ActivityClientRecord r,
            PendingTransactionActions pendingActions);
            PendingTransactionActions pendingActions, ActivityOptions activityOptions);

    /** Get package info. */
    public abstract LoadedApk getPackageInfoNoCheck(ApplicationInfo ai,
+0 −1
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ interface IActivityClientController {
    String getCallingPackage(in IBinder token);
    int getLaunchedFromUid(in IBinder token);
    String getLaunchedFromPackage(in IBinder token);
    Bundle getActivityOptions(in IBinder token);

    void setRequestedOrientation(in IBinder token, int requestedOrientation);
    int getRequestedOrientation(in IBinder token);
Loading