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

Commit fa06f2da authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Exempt ARC/TV from enable_pip2_implementation flag

Per discussion, the enable_pip2_implementation will not force the
implementation choice on ARC and/or TV. ARC and TV can have their own
trunk stable flag when they start to adopt the new implementation.

See also go/pip-quality-plan

Bug: 311462191
Test: m -j
Change-Id: I2f5ab961e521565033786e9bdbc293b9901babe1
parent 533ec746
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -16,10 +16,12 @@
package com.android.wm.shell.common.pip

import android.app.ActivityTaskManager
import android.app.AppGlobals
import android.app.RemoteAction
import android.app.WindowConfiguration
import android.content.ComponentName
import android.content.Context
import android.content.pm.PackageManager
import android.os.RemoteException
import android.os.SystemProperties
import android.util.DisplayMetrics
@@ -136,8 +138,23 @@ object PipUtils {
        }
    }

    private var isPip2ExperimentEnabled: Boolean? = null

    /**
     * Returns 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.
     */
    @JvmStatic
    val isPip2ExperimentEnabled: Boolean
        get() = Flags.enablePip2Implementation() || SystemProperties.getBoolean(
                "wm_shell.pip2", false)
    fun isPip2ExperimentEnabled(): Boolean {
        if (isPip2ExperimentEnabled == null) {
            val isArc = AppGlobals.getPackageManager().hasSystemFeature(
                "org.chromium.arc", 0)
            val isTv = AppGlobals.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_LEANBACK, 0)
            isPip2ExperimentEnabled = SystemProperties.getBoolean("wm_shell.pip2", false) ||
                    (Flags.enablePip2Implementation() && !isArc && !isTv)
        }
        return isPip2ExperimentEnabled as Boolean
    }
}
 No newline at end of file
+21 −2
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ import android.content.LocusId;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ConfigurationInfo;
import android.content.pm.FeatureInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.PackageManagerInternal;
@@ -266,6 +267,7 @@ import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.server.LocalManagerRegistry;
import com.android.server.LocalServices;
import com.android.server.SystemConfig;
import com.android.server.SystemService;
import com.android.server.SystemServiceManager;
import com.android.server.UiThread;
@@ -7400,8 +7402,25 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        }
    }

    /** Cache the return value for {@link #isPip2ExperimentEnabled()} */
    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.
     */
    static boolean isPip2ExperimentEnabled() {
        return Flags.enablePip2Implementation() || SystemProperties.getBoolean(
                "wm_shell.pip2", false);
        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;
            sIsPip2ExperimentEnabled = SystemProperties.getBoolean("wm_shell.pip2", false)
                    || (Flags.enablePip2Implementation() && !isArc && !isTv);
        }
        return sIsPip2ExperimentEnabled;
    }
}