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

Commit 19785076 authored by Chris Li's avatar Chris Li Committed by Android (Google) Code Review
Browse files

Merge "Guard hasWindowExtensionsEnabled" into main

parents c1a668ea 516a53b2
Loading
Loading
Loading
Loading
+20 −9
Original line number Diff line number Diff line
@@ -1476,15 +1476,26 @@ public interface WindowManager extends ViewManager {
     */
    @TestApi
    static boolean hasWindowExtensionsEnabled() {
        return HAS_WINDOW_EXTENSIONS_ON_DEVICE
                && ActivityTaskManager.supportsMultiWindow(ActivityThread.currentApplication())
        if (!Flags.enableWmExtensionsForAllFlag() && ACTIVITY_EMBEDDING_GUARD_WITH_ANDROID_15) {
            // Since enableWmExtensionsForAllFlag, HAS_WINDOW_EXTENSIONS_ON_DEVICE is now true
            // on all devices by default as a build file property.
            // Until finishing flag ramp up, only return true when
            // ACTIVITY_EMBEDDING_GUARD_WITH_ANDROID_15 is false, which is set per device by
            // OEMs.
                && (Flags.enableWmExtensionsForAllFlag()
                || !ACTIVITY_EMBEDDING_GUARD_WITH_ANDROID_15);
            return false;
        }

        if (!HAS_WINDOW_EXTENSIONS_ON_DEVICE) {
            return false;
        }

        try {
            return ActivityTaskManager.supportsMultiWindow(ActivityThread.currentApplication());
        } catch (Exception e) {
            // In case the PackageManager is not set up correctly in test.
            Log.e("WindowManager", "Unable to read if the device supports multi window", e);
            return false;
        }
    }

    /**