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

Commit 1af0001d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ied8d32f2,Idf4438d2 into main

* changes:
  Disable aspect ratio settings floating button when already in app menu
  Enable app handle on foldables (reland)
parents bf98361e 39aad1f1
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.view;
import static android.Manifest.permission.CONFIGURE_DISPLAY_COLOR_MODE;
import static android.Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS;
import static android.hardware.flags.Flags.FLAG_OVERLAYPROPERTIES_CLASS_API;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;

import static com.android.server.display.feature.flags.Flags.FLAG_ENABLE_GET_SUPPORTED_REFRESH_RATES;
import static com.android.server.display.feature.flags.Flags.FLAG_HIGHEST_HDR_SDR_RATIO_API;
@@ -58,6 +59,7 @@ import android.os.SystemClock;
import android.util.ArraySet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -1047,6 +1049,19 @@ public final class Display {
        }
    }

    /**
     * Returns the smallest size of the display in dp
     * @hide
     */
    public float getMinSizeDimensionDp() {
        synchronized (mLock) {
            updateDisplayInfoLocked();
            mDisplayInfo.getAppMetrics(mTempMetrics);
            return TypedValue.deriveDimension(COMPLEX_UNIT_DIP,
                    Math.min(mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight), mTempMetrics);
        }
    }

    /**
     * @deprecated Use {@link WindowMetrics#getBounds#width()} instead.
     */
+0 −4
Original line number Diff line number Diff line
@@ -7212,10 +7212,6 @@
         screen. -->
    <bool name="config_dragToMaximizeInDesktopMode">false</bool>

    <!-- Whether showing the app handle is supported on this device.
         If config_isDesktopModeSupported, then this has no effect -->
    <bool name="config_enableAppHandle">false</bool>

    <!-- Frame rate compatibility value for Wallpaper
         FRAME_RATE_COMPATIBILITY_MIN (102) is used by default for lower power consumption -->
    <integer name="config_wallpaperFrameRateCompatibility">102</integer>
+0 −3
Original line number Diff line number Diff line
@@ -5681,9 +5681,6 @@
       screen. -->
  <java-symbol type="bool" name="config_dragToMaximizeInDesktopMode" />

  <!-- Whether showing the app handle is supported on this device -->
  <java-symbol type="bool" name="config_enableAppHandle" />

  <!-- Frame rate compatibility value for Wallpaper -->
  <java-symbol type="integer" name="config_wallpaperFrameRateCompatibility" />

+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ filegroup {
    name: "wm_shell-shared-utils",
    srcs: [
        "src/com/android/wm/shell/shared/TransitionUtil.java",
        "src/com/android/wm/shell/shared/Utils.java",
    ],
}

@@ -71,6 +72,7 @@ java_library {
    srcs: [
        "**/desktopmode/*.java",
        "**/desktopmode/*.kt",
        ":wm_shell-shared-utils",
    ],
    static_libs: [
        "com.android.window.flags.window-aconfig-java",
+46 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.wm.shell.shared;

import android.annotation.NonNull;

import java.util.function.Supplier;

/**
 * This class provides generic utility methods and classes for shell
 */
public class Utils {

    /**
     * Lazily returns object from a supplier with caching
     * @param <T> type of object to get
     */
    public static class Lazy<T> {
        private T mInstance;

        /**
         * @param supplier the supplier to use, when the instance has not yet been initialized
         * @return the cached value or the value from the supplier
         */
        public final T get(@NonNull Supplier<T> supplier) {
            if (mInstance == null) {
                mInstance = supplier.get();
            }
            return mInstance;
        }
    }
}
Loading