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

Commit 88be465c authored by Andrii Kulian's avatar Andrii Kulian Committed by Android (Google) Code Review
Browse files

Merge "Update override config to include some changes from global config" into nyc-dev

parents a72a83a1 f12fce1a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
    public static final int SCREENLAYOUT_COMPAT_NEEDED = 0x10000000;

    /**
     * Bit mask of overall layout of the screen.  Currently there are two
     * Bit mask of overall layout of the screen.  Currently there are four
     * fields:
     * <p>The {@link #SCREENLAYOUT_SIZE_MASK} bits define the overall size
     * of the screen.  They may be one of
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.STARTING_WINDOW_REMOVED;
import static com.android.server.am.ActivityRecord.STARTING_WINDOW_SHOWN;
import static com.android.server.am.ActivityStackSupervisor.FindTaskResult;
import static com.android.server.am.ActivityStackSupervisor.MOVING;
import static com.android.server.am.ActivityStackSupervisor.ON_TOP;
import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS;
import static com.android.server.wm.AppTransition.TRANSIT_ACTIVITY_CLOSE;
@@ -4464,6 +4463,7 @@ final class ActivityStack {
        // Short circuit: if the two configurations are equal (the common case), then there is
        // nothing to do.
        final Configuration newConfig = mService.mConfiguration;
        r.task.sanitizeOverrideConfiguration(newConfig);
        final Configuration taskConfig = r.task.mOverrideConfig;
        if (r.configuration.equals(newConfig)
                && r.taskConfigOverride.equals(taskConfig)
+20 −0
Original line number Diff line number Diff line
@@ -73,6 +73,8 @@ import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_NEVER;
import static android.content.pm.ActivityInfo.RESIZE_MODE_CROP_WINDOWS;
import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE;
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_PRIVILEGED;
import static android.content.res.Configuration.SCREENLAYOUT_LONG_MASK;
import static android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK;
import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LOCKTASK;
@@ -1574,6 +1576,24 @@ final class TaskRecord {
        return bounds;
    }

    /**
     * Update fields that are not overridden for task from global configuration.
     *
     * @param globalConfig global configuration to update from.
     */
    void sanitizeOverrideConfiguration(Configuration globalConfig) {
        // screenLayout field is set in #calculateOverrideConfig but only part of it is really
        // overridden - aspect ratio and size. Other flags (like layout direction) can be updated
        // separately in global config and they also must be updated in override config.
        int overrideScreenLayout = mOverrideConfig.screenLayout;
        int newScreenLayout = globalConfig.screenLayout;
        newScreenLayout = (newScreenLayout & ~SCREENLAYOUT_LONG_MASK)
                | (overrideScreenLayout & SCREENLAYOUT_LONG_MASK);
        newScreenLayout = (newScreenLayout & ~SCREENLAYOUT_SIZE_MASK)
                | (overrideScreenLayout & SCREENLAYOUT_SIZE_MASK);
        mOverrideConfig.screenLayout = newScreenLayout;
    }

    static Rect validateBounds(Rect bounds) {
        if (bounds != null && bounds.isEmpty()) {
            Slog.wtf(TAG, "Received strange task bounds: " + bounds, new Throwable());