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

Commit cbd4919a authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Add enable_pip2_on_tv flag" into main

parents b5b0d174 db683584
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -20,6 +20,13 @@ flag {
    bug: "311462191"
}

flag {
    name: "enable_pip2_on_tv"
    namespace: "multitasking"
    description: "Enables the new implementation of PiP (PiP2) on TV"
    bug: "403347147"
}

flag {
    name: "enable_new_bubble_animations"
    namespace: "multitasking"
+6 −3
Original line number Diff line number Diff line
@@ -24,14 +24,17 @@ import com.android.wm.shell.Flags
class PipFlags {
    companion object {
        /**
         * Returns true if PiP2 implementation should be used. Special note: if PiP on Desktop
         * Windowing is enabled, override the PiP2 gantry flag to be ON.
         * @return {@code true} if PiP2 implementation should be used.
         *
         * Note: if PiP on Desktop Windowing is enabled, override the PiP2 gantry flag to be ON.
         * Note: For form factors other than phone, such as TV, separate flag needs to be ON.
         */
        @JvmStatic
        val isPip2ExperimentEnabled: Boolean by lazy {
            val isTv = AppGlobals.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_LEANBACK, 0)
            (Flags.enablePip2() || ENABLE_DESKTOP_WINDOWING_PIP.isTrue) && !isTv
            (Flags.enablePip2() || ENABLE_DESKTOP_WINDOWING_PIP.isTrue) &&
                    (!isTv || Flags.enablePip2OnTv())
        }

        @JvmStatic
+1 −0
Original line number Diff line number Diff line
@@ -334,6 +334,7 @@ object PipUtils {
        pw.println("${innerPrefix1}isPipUmoExperienceEnabled=${PipFlags.isPipUmoExperienceEnabled}")
        pw.println("${innerPrefix1}isPip2ExperimentEnabled=${PipFlags.isPip2ExperimentEnabled}")
        pw.println("${innerPrefix2}enablePip2=${Flags.enablePip2()}")
        pw.println("${innerPrefix2}enablePip2OnTv=${Flags.enablePip2OnTv()}")
        pw.println("${innerPrefix2}enableDwPip=${ENABLE_DESKTOP_WINDOWING_PIP.isTrue}")
    }
}
+4 −8
Original line number Diff line number Diff line
@@ -7958,23 +7958,19 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    private static Boolean sIsPip2ExperimentEnabled = null;

    /**
     * @return {@code true} if PiP2 implementation should be used. Besides the trunk stable flag,
     * system property can be used to override this read only flag during development.
     * It's currently limited to phone form factor, i.e., not enabled on ARC / TV.
     * @return {@code true} if PiP2 implementation should be used.
     *
     * Special note: if PiP on Desktop Windowing is enabled, override the PiP2 gantry flag to be ON.
     * Note: if PiP on Desktop Windowing is enabled, override the PiP2 gantry flag to be ON.
     * Note: For form factors other than phone, such as TV, separate flag needs to be ON.
     */
    static boolean isPip2ExperimentEnabled() {
        if (sIsPip2ExperimentEnabled == null) {
            final FeatureInfo arcFeature = SystemConfig.getInstance().getAvailableFeatures().get(
                    "org.chromium.arc");
            final FeatureInfo tvFeature = SystemConfig.getInstance().getAvailableFeatures().get(
                    FEATURE_LEANBACK);
            final boolean isArc = arcFeature != null && arcFeature.version >= 0;
            final boolean isTv = tvFeature != null && tvFeature.version >= 0;
            final boolean shouldOverridePip2Flag = ENABLE_DESKTOP_WINDOWING_PIP.isTrue();
            sIsPip2ExperimentEnabled = (Flags.enablePip2() || shouldOverridePip2Flag)
                    && !isArc && !isTv;
                    && (!isTv || Flags.enablePip2OnTv());
        }
        return sIsPip2ExperimentEnabled;
    }