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

Commit cb1e7a96 authored by Ian Elliott's avatar Ian Elliott
Browse files

Defer to Legacy driver if ANGLE deferlist hasn't been initialized

ANGLE's deferlist is populated by the GUI code in the ANGLE APK.  This
code is not immediately run upon first-boot of a newly-flashed device.
This change puts a default deferlist into the GraphicsEnvironment
class, which will be used if the deferlist has not yet been processed.

Bug: 241757590
Test: Manually test and inspect logcat output
Change-Id: I12f355e891dfa466be37da5282af7a9586066c93
parent 60e04f42
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -469,7 +469,15 @@ public class GraphicsEnvironment {
     * 2) The per-application switch (i.e. Settings.Global.ANGLE_GL_DRIVER_SELECTION_PKGS and
     *    Settings.Global.ANGLE_GL_DRIVER_SELECTION_VALUES; which corresponds to the
     *    “angle_gl_driver_selection_pkgs” and “angle_gl_driver_selection_values” settings); if it
     *    forces a choice; otherwise ...
     *    forces a choice;
     *      - Workaround Note: ANGLE and Vulkan currently have issues with applications that use YUV
     *        target functionality.  The ANGLE broadcast receiver code will apply a "deferlist" at
     *        the first boot of a newly-flashed device.  However, there is a gap in time between
     *        when applications can start and when the deferlist is applied.  For now, assume that
     *        if ANGLE is the system driver and Settings.Global.ANGLE_GL_DRIVER_SELECTION_PKGS is
     *        empty, that the deferlist has not yet been applied.  In this case, select the Legacy
     *        driver.
     *    otherwise ...
     * 3) Use ANGLE if isAngleEnabledByGameMode() returns true; otherwise ...
     * 4) The global switch (i.e. use the system driver, whether ANGLE or legacy;
     *    a.k.a. mAngleIsSystemDriver, which is set by the device’s “ro.hardware.egl” property)
@@ -512,6 +520,13 @@ public class GraphicsEnvironment {
        Log.v(TAG, "    angle_gl_driver_selection_pkgs =" + optInPackages);
        Log.v(TAG, "  angle_gl_driver_selection_values =" + optInValues);

        // If ANGLE is the system driver AND the deferlist has not yet been applied, select the
        // Legacy driver
        if (mAngleIsSystemDriver && optInPackages.size() <= 1) {
            Log.v(TAG, "Ignoring angle_gl_driver_selection_* until deferlist has been applied");
            return ANGLE_GL_DRIVER_TO_USE_LEGACY;
        }

        // Make sure we have good settings to use
        if (optInPackages.size() != optInValues.size()) {
            Log.w(TAG,