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

Commit 21663395 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10313683 from 0fe4c4cc to udc-qpr1-release

Change-Id: I34af8dc0ba3bcf5c91db3b4d4585f248b547456d
parents 889a825a 0fe4c4cc
Loading
Loading
Loading
Loading
+19 −65
Original line number Diff line number Diff line
@@ -913,7 +913,7 @@ public class WallpaperManager {
     *     instead the default system wallpaper is returned
     *     (some versions of T may throw a {@code SecurityException}).</li>
     *     <li>From version U, this method should not be used
     *     and will always throw a @code SecurityException}.</li>
     *     and will always throw a {@code SecurityException}.</li>
     *     <li> Apps with {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE}
     *     can still access the real wallpaper on all versions. </li>
     * </ul>
@@ -935,18 +935,9 @@ public class WallpaperManager {
    }

    /**
     * <strong> Important note: </strong>
     * <ul>
     *     <li>Up to version S, this method requires the
     *     {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} permission.</li>
     *     <li>Starting in T, directly accessing the wallpaper is not possible anymore,
     *     instead the default system wallpaper is returned
     *     (some versions of T may throw a {@code SecurityException}).</li>
     *     <li>From version U, this method should not be used
     *     and will always throw a @code SecurityException}.</li>
     *     <li> Apps with {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE}
     *     can still access the real wallpaper on all versions. </li>
     * </ul>
     * <strong> Important note: </strong> only apps with
     * {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE} should use this method.
     * Otherwise, a {@code SecurityException} will be thrown.
     *
     * <p>
     * Retrieve the requested wallpaper for the specified wallpaper type if the wallpaper is not
@@ -1206,7 +1197,7 @@ public class WallpaperManager {
     *     instead the default system wallpaper is returned
     *     (some versions of T may throw a {@code SecurityException}).</li>
     *     <li>From version U, this method should not be used
     *     and will always throw a @code SecurityException}.</li>
     *     and will always throw a {@code SecurityException}.</li>
     *     <li> Apps with {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE}
     *     can still access the real wallpaper on all versions. </li>
     * </ul>
@@ -1228,18 +1219,9 @@ public class WallpaperManager {
    }

    /**
     * <strong> Important note: </strong>
     * <ul>
     *     <li>Up to version S, this method requires the
     *     {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} permission.</li>
     *     <li>Starting in T, directly accessing the wallpaper is not possible anymore,
     *     instead the default system wallpaper is returned
     *     (some versions of T may throw a {@code SecurityException}).</li>
     *     <li>From version U, this method should not be used
     *     and will always throw a @code SecurityException}.</li>
     *     <li> Apps with {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE}
     *     can still access the real wallpaper on all versions. </li>
     * </ul>
     * <strong> Important note: </strong> only apps with
     * {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE} should use this method.
     * Otherwise, a {@code SecurityException} will be thrown.
     *
     * <p>
     * Equivalent to {@link #getDrawable(int)}.
@@ -1268,7 +1250,7 @@ public class WallpaperManager {
     *     instead the default wallpaper is returned
     *     (some versions of T may throw a {@code SecurityException}).</li>
     *     <li>From version U, this method should not be used
     *     and will always throw a @code SecurityException}.</li>
     *     and will always throw a {@code SecurityException}.</li>
     *     <li> Apps with {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE}
     *     can still access the real wallpaper on all versions. </li>
     * </ul>
@@ -1290,19 +1272,9 @@ public class WallpaperManager {
    }

    /**
     * <strong> Important note: </strong>
     * <ul>
     *     <li>Up to version S, this method requires the
     *     {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} permission.</li>
     *     <li>Starting in T, directly accessing the wallpaper is not possible anymore,
     *     instead the default system wallpaper is returned
     *     (some versions of T may throw a {@code SecurityException}).</li>
     *     <li>From version U, this method should not be used
     *     and will always throw a @code SecurityException}.</li>
     *     <li> Apps with {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE}
     *     can still access the real wallpaper on all versions. </li>
     * </ul>
     * <br>
     * <strong> Important note: </strong> only apps with
     * {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE} should use this method.
     * Otherwise, a {@code SecurityException} will be thrown.
     *
     * Like {@link #getDrawable(int)}, but the returned Drawable has a number
     * of limitations to reduce its overhead as much as possible. It will
@@ -1334,18 +1306,9 @@ public class WallpaperManager {
    }

    /**
     * <strong> Important note: </strong>
     * <ul>
     *     <li>Up to version S, this method requires the
     *     {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} permission.</li>
     *     <li>Starting in T, directly accessing the wallpaper is not possible anymore,
     *     instead the default system wallpaper is returned
     *     (some versions of T may throw a {@code SecurityException}).</li>
     *     <li>From version U, this method should not be used
     *     and will always throw a @code SecurityException}.</li>
     *     <li> Apps with {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE}
     *     can still access the real wallpaper on all versions. </li>
     * </ul>
     * <strong> Important note: </strong> only apps with
     * {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE} should use this method.
     * Otherwise, a {@code SecurityException} will be thrown.
     *
     * <p>
     * Equivalent to {@link #getFastDrawable()}.
@@ -1364,18 +1327,9 @@ public class WallpaperManager {
    }

    /**
     * <strong> Important note: </strong>
     * <ul>
     *     <li>Up to version S, this method requires the
     *     {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} permission.</li>
     *     <li>Starting in T, directly accessing the wallpaper is not possible anymore,
     *     instead the default system wallpaper is returned
     *     (some versions of T may throw a {@code SecurityException}).</li>
     *     <li>From version U, this method should not be used
     *     and will always throw a @code SecurityException}.</li>
     *     <li> Apps with {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE}
     *     can still access the real wallpaper on all versions. </li>
     * </ul>
     * <strong> Important note: </strong> only apps with
     * {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE}
     * should use this method. Otherwise, a {@code SecurityException} will be thrown.
     *
     * <p>
     * Equivalent to {@link #getFastDrawable(int)}.
@@ -1562,7 +1516,7 @@ public class WallpaperManager {
     *     instead the default system wallpaper is returned
     *     (some versions of T may throw a {@code SecurityException}).</li>
     *     <li>From version U, this method should not be used
     *     and will always throw a @code SecurityException}.</li>
     *     and will always throw a {@code SecurityException}.</li>
     *     <li> Apps with {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE}
     *     can still access the real wallpaper on all versions. </li>
     * </ul>
+22 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public final class KeyboardLayout implements Parcelable, Comparable<KeyboardLayo
    private final int mProductId;

    /** Currently supported Layout types in the KCM files */
    private enum LayoutType {
    public enum LayoutType {
        UNDEFINED(0, LAYOUT_TYPE_UNDEFINED),
        QWERTY(1, LAYOUT_TYPE_QWERTY),
        QWERTZ(2, LAYOUT_TYPE_QWERTZ),
@@ -88,9 +88,11 @@ public final class KeyboardLayout implements Parcelable, Comparable<KeyboardLayo
        private final int mValue;
        private final String mName;
        private static final Map<Integer, LayoutType> VALUE_TO_ENUM_MAP = new HashMap<>();
        private static final Map<String, LayoutType> NAME_TO_ENUM_MAP = new HashMap<>();
        static {
            for (LayoutType type : LayoutType.values()) {
                VALUE_TO_ENUM_MAP.put(type.mValue, type);
                NAME_TO_ENUM_MAP.put(type.mName, type);
            }
        }

@@ -110,6 +112,25 @@ public final class KeyboardLayout implements Parcelable, Comparable<KeyboardLayo
        private String getName() {
            return mName;
        }

        /**
         * Returns enum value for provided layout type
         * @param layoutName name of the layout type
         * @return int value corresponding to the LayoutType enum that matches the layout name.
         * (LayoutType.UNDEFINED if no match found)
         */
        public static int getLayoutTypeEnumValue(String layoutName) {
            return NAME_TO_ENUM_MAP.getOrDefault(layoutName, UNDEFINED).getValue();
        }

        /**
         * Returns name for provided layout type enum value
         * @param enumValue value representation for LayoutType enum
         * @return Layout name corresponding to the enum value (LAYOUT_TYPE_UNDEFINED if not found)
         */
        public static String getLayoutNameFromValue(int enumValue) {
            return VALUE_TO_ENUM_MAP.getOrDefault(enumValue, UNDEFINED).getName();
        }
    }

    @NonNull
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ public class DisplayChangeController {
    }

    /** Query all listeners for changes that should happen on display change. */
    public void dispatchOnDisplayChange(WindowContainerTransaction outWct, int displayId,
    void dispatchOnDisplayChange(WindowContainerTransaction outWct, int displayId,
            int fromRotation, int toRotation, DisplayAreaInfo newDisplayAreaInfo) {
        for (OnDisplayChangingListener c : mDisplayChangeListener) {
            c.onDisplayChange(displayId, fromRotation, toRotation, newDisplayAreaInfo, outWct);
+21 −5
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.view.Display;
import android.view.IDisplayWindowListener;
import android.view.IWindowManager;
import android.view.InsetsState;
import android.window.WindowContainerTransaction;

import androidx.annotation.BinderThread;

@@ -85,11 +86,6 @@ public class DisplayController {
        }
    }

    /** Get the DisplayChangeController. */
    public DisplayChangeController getChangeController() {
        return mChangeController;
    }

    /**
     * Gets a display by id from DisplayManager.
     */
@@ -195,6 +191,26 @@ public class DisplayController {
        }
    }


    /** Called when a display rotate requested. */
    public void onDisplayRotateRequested(WindowContainerTransaction wct, int displayId,
            int fromRotation, int toRotation) {
        synchronized (mDisplays) {
            final DisplayRecord dr = mDisplays.get(displayId);
            if (dr == null) {
                Slog.w(TAG, "Skipping Display rotate on non-added display.");
                return;
            }

            if (dr.mDisplayLayout != null) {
                dr.mDisplayLayout.rotateTo(dr.mContext.getResources(), toRotation);
            }

            mChangeController.dispatchOnDisplayChange(
                    wct, displayId, fromRotation, toRotation, null /* newDisplayAreaInfo */);
        }
    }

    private void onDisplayConfigurationChanged(int displayId, Configuration newConfig) {
        synchronized (mDisplays) {
            final DisplayRecord dr = mDisplays.get(displayId);
+34 −6
Original line number Diff line number Diff line
@@ -500,36 +500,62 @@ class DesktopTasksController(
            request
        )
        // Check if we should skip handling this transition
        var reason = ""
        val shouldHandleRequest =
            when {
                // Only handle open or to front transitions
                request.type != TRANSIT_OPEN && request.type != TRANSIT_TO_FRONT -> false
                request.type != TRANSIT_OPEN && request.type != TRANSIT_TO_FRONT -> {
                    reason = "transition type not handled (${request.type})"
                    false
                }
                // Only handle when it is a task transition
                request.triggerTask == null -> false
                request.triggerTask == null -> {
                    reason = "triggerTask is null"
                    false
                }
                // Only handle standard type tasks
                request.triggerTask.activityType != ACTIVITY_TYPE_STANDARD -> false
                request.triggerTask.activityType != ACTIVITY_TYPE_STANDARD -> {
                    reason = "activityType not handled (${request.triggerTask.activityType})"
                    false
                }
                // Only handle fullscreen or freeform tasks
                request.triggerTask.windowingMode != WINDOWING_MODE_FULLSCREEN &&
                        request.triggerTask.windowingMode != WINDOWING_MODE_FREEFORM -> false
                        request.triggerTask.windowingMode != WINDOWING_MODE_FREEFORM -> {
                    reason = "windowingMode not handled (${request.triggerTask.windowingMode})"
                    false
                }
                // Otherwise process it
                else -> true
            }

        if (!shouldHandleRequest) {
            KtProtoLog.v(
                    WM_SHELL_DESKTOP_MODE,
                    "DesktopTasksController: skipping handleRequest reason=%s",
                    reason
            )
            return null
        }

        val task: RunningTaskInfo = request.triggerTask

        return when {
        val result = when {
            // If display has tasks stashed, handle as stashed launch
            desktopModeTaskRepository.isStashed(task.displayId) -> handleStashedTaskLaunch(task)
            // Check if fullscreen task should be updated
            task.windowingMode == WINDOWING_MODE_FULLSCREEN -> handleFullscreenTaskLaunch(task)
            // Check if freeform task should be updated
            task.windowingMode == WINDOWING_MODE_FREEFORM -> handleFreeformTaskLaunch(task)
            else -> null
            else -> {
                null
            }
        }
        KtProtoLog.v(
                WM_SHELL_DESKTOP_MODE,
                "DesktopTasksController: handleRequest result=%s",
                result ?: "null"
        )
        return result
    }

    /**
@@ -552,6 +578,7 @@ class DesktopTasksController(
    }

    private fun handleFreeformTaskLaunch(task: RunningTaskInfo): WindowContainerTransaction? {
        KtProtoLog.v(WM_SHELL_DESKTOP_MODE, "DesktopTasksController: handleFreeformTaskLaunch")
        val activeTasks = desktopModeTaskRepository.getActiveTasks(task.displayId)
        if (activeTasks.none { desktopModeTaskRepository.isVisibleTask(it) }) {
            KtProtoLog.d(
@@ -568,6 +595,7 @@ class DesktopTasksController(
    }

    private fun handleFullscreenTaskLaunch(task: RunningTaskInfo): WindowContainerTransaction? {
        KtProtoLog.v(WM_SHELL_DESKTOP_MODE, "DesktopTasksController: handleFullscreenTaskLaunch")
        val activeTasks = desktopModeTaskRepository.getActiveTasks(task.displayId)
        if (activeTasks.any { desktopModeTaskRepository.isVisibleTask(it) }) {
            KtProtoLog.d(
Loading