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

Commit a99952c1 authored by Bryce Lee's avatar Bryce Lee Committed by Android (Google) Code Review
Browse files

Merge "Revert "Allow opening activity to specify orientation.""

parents 26dbff35 2fb7de3d
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -1899,22 +1899,11 @@ final class ActivityRecord implements AppWindowContainerListener {
                task.taskId, requestedOrientation);
    }

    /**
     * Set the last reported global configuration to the client. Should be called whenever a new
     * global configuration is sent to the client for this activity.
     */
    void setLastReportedGlobalConfiguration(@NonNull Configuration config) {
    // TODO: now used only in one place to address race-condition. Remove when that will be fixed.
    void setLastReportedConfiguration(@NonNull Configuration config) {
        mLastReportedConfiguration.setTo(config);
    }

    /**
     * Set the last reported merged configuration to the client. Should be called whenever a new
     * merged configuration is sent to the client for this activity.
     */
    void setLastReportedMergedOverrideConfiguration(@NonNull Configuration config) {
        mLastReportedOverrideConfiguration.setTo(config);
    }

    /** Call when override config was sent to the Window Manager to update internal records. */
    void onOverrideConfigurationSent() {
        mLastReportedOverrideConfiguration.setTo(task.getMergedOverrideConfiguration());
+3 −11
Original line number Diff line number Diff line
@@ -1333,18 +1333,10 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
            // Because we could be starting an Activity in the system process this may not go across
            // a Binder interface which would create a new Configuration. Consequently we have to
            // always create a new Configuration here.

            final Configuration globalConfiguration =
                new Configuration(mService.getGlobalConfiguration());
            r.setLastReportedGlobalConfiguration(globalConfiguration);
            final Configuration mergedOverrideConfiguration =
                new Configuration(task.getMergedOverrideConfiguration());
            r.setLastReportedMergedOverrideConfiguration(mergedOverrideConfiguration);

            app.thread.scheduleLaunchActivity(new Intent(r.intent), r.appToken,
                    System.identityHashCode(r), r.info,
                    globalConfiguration,
                    mergedOverrideConfiguration, r.compat,
                    new Configuration(mService.getGlobalConfiguration()),
                    new Configuration(task.getMergedOverrideConfiguration()), r.compat,
                    r.launchedFromPackage, task.voiceInteractor, app.repProcState, r.icicle,
                    r.persistentState, results, newIntents, !andResume,
                    mService.isNextTransitionForward(), profilerInfo);
@@ -1739,7 +1731,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
            // We'll update with whatever configuration it now says
            // it used to launch.
            if (config != null) {
                r.setLastReportedGlobalConfiguration(config);
                r.setLastReportedConfiguration(config);
            }

            // We are now idle.  If someone is waiting for a thumbnail from
+3 −4
Original line number Diff line number Diff line
@@ -1151,12 +1151,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
     */
    @Override
    int getOrientation() {
        if (fillsParent() && (isVisible() || mService.mOpeningApps.contains(this))) {
            return mOrientation;
        }

        if (hidden || hiddenRequested) {
            return SCREEN_ORIENTATION_UNSET;
        }
        return mOrientation;
    }

    /** Returns the app's preferred orientation regardless of its currently visibility state. */
    int getOrientationIgnoreVisibility() {
+5 −4
Original line number Diff line number Diff line
@@ -510,13 +510,14 @@ class WindowContainer<E extends WindowContainer> implements Comparable<WindowCon
     * specification...
     */
    int getOrientation() {
        if (!fillsParent()) {
            // Ignore containers that don't completely fills their parents.

        if (!fillsParent() || !isVisible()) {
            // Ignore invisible containers or containers that don't completely fills their parents.
            return SCREEN_ORIENTATION_UNSET;
        }

        // The container fills its parent and is visible so we can use it orientation if it has one
        // specified; otherwise we prefer to use the orientation of its topmost child that has one
        // The container fills its parent so we can use it orientation if it has one specified,
        // otherwise we prefer to use the orientation of its topmost child that has one
        // specified and fall back on this container's unset or unspecified value as a candidate
        // if none of the children have a better candidate for the orientation.
        if (mOrientation != SCREEN_ORIENTATION_UNSET
+0 −9
Original line number Diff line number Diff line
@@ -2442,15 +2442,6 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    /**
     * Updates the device orientation from the present app tokens.
     *
     * Note: A place this is method called is before an {@link android.app.Activity} starts to
     * ensure that it is created in the proper orientation. It is imperative that the present
     * {@link AppWindowToken} specify that they can influence the orientation, accomplished with the
     * override of {@link WindowContainer#canSpecifyOrientation()}. Visibility changes only will not
     * guarantee this as other operations (such as freezing the screen) can defer these operations.
     */
    @Override
    public Configuration updateOrientationFromAppTokens(Configuration currentConfig,
            IBinder freezeThisOneIfNeeded, int displayId) {
Loading