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

Commit a35e865b authored by Yiwei Zhang's avatar Yiwei Zhang
Browse files

GUP: Update global property for the new dev opt

We updated the development opt in mechanism for GUP. Now we have
GUP_DEV_OPT_IN_APPS for applications selected to use GUP and
GUP_DEV_OPT_OUT_APPS for applications selected not to use GUP.

Bug: 119221883
Test: Build, flash and boot, verify with prototype
Change-Id: I52869ecf9e411a8dbdc1146f00c82023ba41bebf
Merged-In: I52869ecf9e411a8dbdc1146f00c82023ba41bebf
parent a08443c5
Loading
Loading
Loading
Loading
+28 −7
Original line number Diff line number Diff line
@@ -33,6 +33,9 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/** @hide */
public class GraphicsEnvironment {
@@ -136,6 +139,19 @@ public class GraphicsEnvironment {
        setLayerPaths(mClassLoader, layerPaths);
    }

    private static List<String> getGlobalSettingsString(Bundle bundle, String globalSetting) {
        List<String> valueList = null;
        String settingsValue = bundle.getString(globalSetting);

        if (settingsValue != null) {
            valueList = new ArrayList<>(Arrays.asList(settingsValue.split(",")));
        } else {
            valueList = new ArrayList<>();
        }

        return valueList;
    }

    /**
     * Choose whether the current process should use the builtin or an updated driver.
     */
@@ -154,14 +170,19 @@ public class GraphicsEnvironment {
            return;
        }

        String applicationPackageName = context.getPackageName();
        String devOptInApplicationName = coreSettings.getString(
                Settings.Global.GUP_DEV_OPT_IN_APPS);
        boolean devOptIn = applicationPackageName.equals(devOptInApplicationName);
        boolean whitelisted = onWhitelist(context, driverPackageName, ai.packageName);
        if (!devOptIn && !whitelisted) {
        if (getGlobalSettingsString(coreSettings, Settings.Global.GUP_DEV_OPT_OUT_APPS)
                        .contains(ai.packageName)) {
            if (DEBUG) {
                Log.w(TAG, ai.packageName + " opts out from GUP.");
            }
            return;
        }

        if (!getGlobalSettingsString(coreSettings, Settings.Global.GUP_DEV_OPT_IN_APPS)
                        .contains(ai.packageName)
                && !onWhitelist(context, driverPackageName, ai.packageName)) {
            if (DEBUG) {
                Log.w(TAG, applicationPackageName + " is not on the whitelist.");
                Log.w(TAG, ai.packageName + " is not on the whitelist.");
            }
            return;
        }
+7 −1
Original line number Diff line number Diff line
@@ -11446,11 +11446,17 @@ public final class Settings {
        public static final String GPU_DEBUG_APP = "gpu_debug_app";
        /**
         * Apps that are selected to use Game Update Package.
         * List of Apps selected to use Game Update Packages.
         * @hide
         */
        public static final String GUP_DEV_OPT_IN_APPS = "gup_dev_opt_in_apps";
        /**
         * List of Apps selected not to use Game Update Packages.
         * @hide
         */
        public static final String GUP_DEV_OPT_OUT_APPS = "gup_dev_opt_out_apps";
        /**
         * Apps on the black list that are forbidden to useGame Update Package.
         * @hide
+5 −4
Original line number Diff line number Diff line
@@ -384,11 +384,12 @@ message GlobalSettingsProto {
        // App allowed to load GPU debug layers.
        optional SettingProto debug_app = 1;
        optional SettingProto debug_layers = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
        // Apps opt in to load graphics driver from Game Update Package
        // instead of native graphcis driver through developer options.
        // GUP - List of Apps selected to use Game Update Packages
        optional SettingProto gup_dev_opt_in_apps = 8;
        // Apps on the black list that are forbidden to useGame Update Package.
        optional SettingProto gup_black_list = 9;
        // GUP - List of Apps selected not to use Game Update Packages
        optional SettingProto gup_dev_opt_out_apps = 9;
        // GUP - List of Apps that are forbidden to use Game Update Packages
        optional SettingProto gup_black_list = 10;
    }
    optional Gpu gpu = 59;

+1 −0
Original line number Diff line number Diff line
@@ -445,6 +445,7 @@ public class SettingsBackupTest {
                    Settings.Global.GPU_DEBUG_APP,
                    Settings.Global.GPU_DEBUG_LAYERS,
                    Settings.Global.GUP_DEV_OPT_IN_APPS,
                    Settings.Global.GUP_DEV_OPT_OUT_APPS,
                    Settings.Global.GUP_BLACK_LIST,
                    Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING,
                    Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT,
+0 −3
Original line number Diff line number Diff line
@@ -1131,7 +1131,4 @@

    <!-- The notice header of Third-party licenses. not translatable -->
    <string name="notice_header" translatable="false"></string>

    <!-- UI debug setting: opt in to use updated graphics driver? [CHAR LIMIT=100] -->
    <string name="gup_dev_opt_in_app_summary">Opt in app to use Game Update Package in developement</string>
</resources>
Loading