Remove OpenGL ES 3.0 setting from developer options

Revert all commits that introduced and adjusted the experimental
OpenGL ES 3.0 setting. The system provides a dedicated settings section
outside of the developer options now.

This reverts commit bf37d777cac269dcad7cf644d8271cca87ee3a88.
This reverts commit 454d14da10ade1ffff20191d3c5e5c5b5b0d629c.
This reverts commit aca115d71ba9b7593bf1cf1f489a02d072c88d73.

Issue: FP2N-387
Change-Id: I398f5c9b5cf433afd0a68653426abcb6bb459d46
diff --git a/res/values/fairphone_strings.xml b/res/values/fairphone_strings.xml
index 52b920e..e8c2a2b 100644
--- a/res/values/fairphone_strings.xml
+++ b/res/values/fairphone_strings.xml
@@ -49,8 +49,4 @@
     <string name="battery_module_summary" translatable="false"><xliff:g id="version"
             example="FP2-BAT01">%1$s</xliff:g> &#8211; <xliff:g id="capacity"
             example="2420">%2$d</xliff:g> mAh</string>
-
-    <!-- Developer settings screen, experimental OpenGL ES 3.0 setting. -->
-    <string name="experimental_gles3_title">Experimental OpenGL ES 3.0</string>
-    <string name="experimental_gles3_summary_ask_restart">Please restart your phone to apply the new setting.</string>
 </resources>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index ecdf0e1..1a94407 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -17,11 +17,6 @@
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
         android:title="@string/development_settings_title">
-
-    <SwitchPreference
-        android:key="experimental_gles3"
-        android:title="@string/experimental_gles3_title" />
-
     <com.android.settings.BugreportPreference
             android:key="bugreport"
             android:title="@*android:string/bugreport_title"
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index e7e577e..3601fb3 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -89,17 +89,10 @@
 import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
 import com.android.settingslib.RestrictedSwitchPreference;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
-import java.util.InputMismatchException;
 import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Scanner;
 
 /*
  * Displays preferences for application developers.
@@ -119,8 +112,6 @@
      */
     public static final String PREF_SHOW = "show";
 
-    private static final String EXPERIMENTAL_GLES3_PROPERTY = "experimental_gles3";
-    private static final String EXPERIMENTAL_GLES3_PROPERTY_FILE = "/data/misc/fairphone/experimental_gles3";
     private static final String ENABLE_ADB = "enable_adb";
     private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
     private static final String ENABLE_TERMINAL = "enable_terminal";
@@ -255,7 +246,6 @@
     private SwitchPreference mEnableAdb;
     private Preference mClearAdbKeys;
     private SwitchPreference mEnableTerminal;
-    private SwitchPreference mExperimentalGLES3;
     private Preference mBugreport;
     private SwitchPreference mBugreportInPower;
     private RestrictedSwitchPreference mKeepScreenOn;
@@ -397,7 +387,6 @@
             mEnableTerminal = null;
         }
 
-        mExperimentalGLES3 = findAndInitSwitchPref(EXPERIMENTAL_GLES3_PROPERTY);
         mBugreport = findPreference(BUGREPORT);
         mBugreportInPower = findAndInitSwitchPref(BUGREPORT_IN_POWER_KEY);
         mKeepScreenOn = (RestrictedSwitchPreference) findAndInitSwitchPref(KEEP_SCREEN_ON);
@@ -712,9 +701,6 @@
                     context.getPackageManager().getApplicationEnabledSetting(TERMINAL_APP_PACKAGE)
                             == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
         }
-
-        updateFairphoneExperimentalOptions();
-
         updateSwitchPreference(mBugreportInPower, Settings.Secure.getInt(cr,
                 Settings.Global.BUGREPORT_IN_POWER_MENU, 0) != 0);
         updateSwitchPreference(mKeepScreenOn, Settings.Global.getInt(cr,
@@ -798,45 +784,6 @@
         pokeSystemProperties();
     }
 
-    private boolean readCurrentExperimentalGLES3Option() {
-        boolean result = false;
-        try {
-            Scanner exptGLES3Reader = new Scanner(new File(EXPERIMENTAL_GLES3_PROPERTY_FILE));
-            result = exptGLES3Reader.nextInt() == 1;
-            exptGLES3Reader.close();
-        } catch (FileNotFoundException | NoSuchElementException e) {
-            Log.d(TAG, "No choice stored regarding experimental OpenGL ES 3.0. "
-                    + "Falling back to default (off).");
-        }
-        return result;
-    }
-
-    private void updateFairphoneExperimentalOptions() {
-        updateSwitchPreference(mExperimentalGLES3, readCurrentExperimentalGLES3Option());
-
-        // Notify the user if a reboot is required to apply the new setting.
-        final String glesVersionSystemProp = SystemProperties.get("ro.opengles.version");
-        final String glesV30String = "196608";
-        final boolean expGLES3SystemState = glesVersionSystemProp.equals(glesV30String);
-        if (expGLES3SystemState) {
-            mExperimentalGLES3.setSummaryOn("");
-            mExperimentalGLES3.setSummaryOff(R.string.experimental_gles3_summary_ask_restart);
-        } else {
-            mExperimentalGLES3.setSummaryOn(R.string.experimental_gles3_summary_ask_restart);
-            mExperimentalGLES3.setSummaryOff("");
-        }
-    }
-
-    private void writeExperimentalGLES3Option() {
-        try {
-            FileWriter wr = new FileWriter(EXPERIMENTAL_GLES3_PROPERTY_FILE);
-            wr.write(mExperimentalGLES3.isChecked() ? "1" : "0");
-            wr.close();
-        } catch(IOException e) {
-            Log.e(TAG, "Error while writing ExperimentalGLES3 file.", e);
-        }
-    }
-
     private void updateWebViewProviderOptions() {
         try {
             WebViewProviderInfo[] providers = mWebViewUpdateService.getValidWebViewPackages();
@@ -2034,10 +1981,7 @@
             return false;
         }
 
-        if (preference == mExperimentalGLES3) {
-            writeExperimentalGLES3Option();
-        }
-        else if (preference == mEnableAdb) {
+        if (preference == mEnableAdb) {
             if (mEnableAdb.isChecked()) {
                 mDialogClicked = false;
                 if (mAdbDialog != null) dismissDialogs();