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

Commit 25b270c0 authored by Yuxin Hu's avatar Yuxin Hu
Browse files

Add developer option switch to set ANGLE as the default system driver

This change adds a new developer option switch called
"Enable ANGLE". It defaults to off. User can choose
to toggle it on and off, and the value of the system
property "persist.graphics.egl" is changed accordingly:

switch off: persist.graphics.egl=""
switch on: persist.graphics.egl="angle"

When user toggles the switch, a reboot window is
popped up asking user to reboot now to make the change
takes effect. If user chooses to cancel the reboot,
the switch is toggled back. This enforces that a reboot
is required whenever the "persis.graphics.egl" value
changes.

Upon reboot, we will load either ANGLE or native
GLES driver as the system driver, based on the value of
"persist.graphics.egl".

The switch is disabled if ANGLE is not installed
in /vendor partition. We use the system property
"ro.gfx.angle.supported" as an indicator. We set the
two conditions together in angle.mk file. Any device
mk file that inherits angle.mk file will result in
ANGLE libs installed in /vendor and "ro.gfx.angle.supported"
set to true.

Bug: b/270994705
Test: m; flash and check Pixel 7 boots fine
atest SettingsRoboTests:GraphicsDriverEnableAngleAsSystemDriverControllerTest

Change-Id: I565eff614472bb6ba50742e7dfa49b50dca2809f
parent 0927e2af
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -10440,6 +10440,13 @@
        <item>@string/graphics_driver_app_preference_system</item>
    </string-array>
    <!-- Debugging developer settings: enable angle as system driver? [CHAR LIMIT=50] -->
    <string name="enable_angle_as_system_driver">Enable ANGLE</string>
    <!-- Debugging developer settings: enable angle as system driver summary [CHAR LIMIT=NONE] -->
    <string name="enable_angle_as_system_driver_summary">Enable ANGLE as system OpenGL ES driver</string>
    <!--Dialog body text used to explain a reboot is required after changing ANGLE as system GLES driver setting-->
    <string name="reboot_dialog_enable_angle_as_system_driver">A reboot is required to change the system OpenGL ES driver</string>
    <!-- Title for App Compatibility Changes dashboard where developers can configure per-app overrides for compatibility changes [CHAR LIMIT=50] -->
    <string name="platform_compat_dashboard_title">App Compatibility Changes</string>
    <!-- Summary for App Compatibility Changes dashboard [CHAR LIMIT=NONE] -->
+5 −0
Original line number Diff line number Diff line
@@ -243,6 +243,11 @@
            android:title="@string/enable_gpu_debug_layers"
            android:summary="@string/enable_gpu_debug_layers_summary" />

        <SwitchPreference
            android:key="enable_angle_as_system_driver"
            android:title="@string/enable_angle_as_system_driver"
            android:summary="@string/enable_angle_as_system_driver_summary" />

        <Preference
            android:key="graphics_driver_dashboard"
            android:title="@string/graphics_driver_dashboard_title"
+0 −7
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.settings.development;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.provider.Settings;

@@ -83,12 +82,6 @@ public class DesktopModePreferenceController extends DeveloperOptionsPreferenceC
        ((SwitchPreference) mPreference).setChecked(false);
    }

    @Override
    public void onRebootConfirmed() {
        final Intent intent = new Intent(Intent.ACTION_REBOOT);
        mContext.startActivity(intent);
    }

    @VisibleForTesting
    String getBuildType() {
        return Build.TYPE;
+2 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import com.android.settings.development.bluetooth.BluetoothCodecDialogPreference
import com.android.settings.development.bluetooth.BluetoothHDAudioPreferenceController;
import com.android.settings.development.bluetooth.BluetoothQualityDialogPreferenceController;
import com.android.settings.development.bluetooth.BluetoothSampleRateDialogPreferenceController;
import com.android.settings.development.graphicsdriver.GraphicsDriverEnableAngleAsSystemDriverController;
import com.android.settings.development.qstile.DevelopmentTiles;
import com.android.settings.development.storage.SharedDataPreferenceController;
import com.android.settings.overlay.FeatureFactory;
@@ -640,6 +641,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
        controllers.add(new SelectDebugAppPreferenceController(context, fragment));
        controllers.add(new WaitForDebuggerPreferenceController(context));
        controllers.add(new EnableGpuDebugLayersPreferenceController(context));
        controllers.add(new GraphicsDriverEnableAngleAsSystemDriverController(context, fragment));
        controllers.add(new ForcePeakRefreshRatePreferenceController(context));
        controllers.add(new EnableVerboseVendorLoggingPreferenceController(context));
        controllers.add(new VerifyAppsOverUsbPreferenceController(context));
+0 −7
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.settings.development;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.provider.Settings;

@@ -81,12 +80,6 @@ public class FreeformWindowsPreferenceController extends DeveloperOptionsPrefere
        ((SwitchPreference) mPreference).setChecked(false);
    }

    @Override
    public void onRebootConfirmed() {
        final Intent intent = new Intent(Intent.ACTION_REBOOT);
        mContext.startActivity(intent);
    }

    @VisibleForTesting
    String getBuildType() {
        return Build.TYPE;
Loading