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

Commit ae175cfe authored by Konsta's avatar Konsta Committed by Ethan Chen
Browse files

add option to force high-end graphics on low memory devices

Change-Id: I34e0d7381615485b58385abed743e01f7272772d
parent 580966b6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -574,6 +574,10 @@ two in order to insert additional control points. \'Remove\' deletes the selecte
    <string name="pref_use_16bpp_alpha_title">16bit transparency</string>
    <string name="pref_use_16bpp_alpha_summary">Better graphics performance, but lower quality and may cause visual artifacts (requires reboot)</string>

    <!-- Performance : Force high-end graphics -->
    <string name="pref_force_highend_gfx_title">Force high-end graphics</string>
    <string name="pref_force_highend_gfx_summary">Enables high-end visual effects such as transparent status/navigation bar (requires reboot)</string>

    <!-- Kill app long-press back -->
    <string name="kill_app_longpress_back">Kill app back button</string>
    <string name="kill_app_longpress_back_summary">Kill the foreground app by long-pressing the back button</string>
+5 −0
Original line number Diff line number Diff line
@@ -45,4 +45,9 @@
        android:title="@string/pref_use_16bpp_alpha_title"
        android:summary="@string/pref_use_16bpp_alpha_summary" />

    <CheckBoxPreference
        android:key="pref_force_highend_gfx"
        android:title="@string/pref_force_highend_gfx_title"
        android:summary="@string/pref_force_highend_gfx_summary" />

</PreferenceScreen>
+16 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.settings.cyanogenmod;

import android.app.ActivityManager;
import android.app.AlertDialog;
import android.content.ContentResolver;
import android.content.DialogInterface;
@@ -46,8 +47,12 @@ public class PerformanceSettings extends SettingsPreferenceFragment implements

    private static final String USE_16BPP_ALPHA_PROP = "persist.sys.use_16bpp_alpha";

    private static final String FORCE_HIGHEND_GFX_PREF = "pref_force_highend_gfx";
    private static final String FORCE_HIGHEND_GFX_PERSIST_PROP = "persist.sys.force_highendgfx";

    private ListPreference mPerfProfilePref;
    private CheckBoxPreference mUse16bppAlphaPref;
    private CheckBoxPreference mForceHighEndGfx;

    private String[] mPerfProfileEntries;
    private String[] mPerfProfileValues;
@@ -101,6 +106,14 @@ public class PerformanceSettings extends SettingsPreferenceFragment implements
        String use16bppAlpha = SystemProperties.get(USE_16BPP_ALPHA_PROP, "0");
        mUse16bppAlphaPref.setChecked("1".equals(use16bppAlpha));

        if (ActivityManager.isLowRamDeviceStatic()) {
            mForceHighEndGfx = (CheckBoxPreference) prefSet.findPreference(FORCE_HIGHEND_GFX_PREF);
            String forceHighendGfx = SystemProperties.get(FORCE_HIGHEND_GFX_PERSIST_PROP, "false");
            mForceHighEndGfx.setChecked("true".equals(forceHighendGfx));
        } else {
            prefSet.removePreference(findPreference(FORCE_HIGHEND_GFX_PREF));
        }

        /* Display the warning dialog */
        alertDialog = new AlertDialog.Builder(getActivity()).create();
        alertDialog.setTitle(R.string.performance_settings_warning_title);
@@ -141,6 +154,9 @@ public class PerformanceSettings extends SettingsPreferenceFragment implements
        if (preference == mUse16bppAlphaPref) {
            SystemProperties.set(USE_16BPP_ALPHA_PROP,
                    mUse16bppAlphaPref.isChecked() ? "1" : "0");
        } else if (preference == mForceHighEndGfx) {
            SystemProperties.set(FORCE_HIGHEND_GFX_PERSIST_PROP,
                    mForceHighEndGfx.isChecked() ? "true" : "false");
        } else {
            // If we didn't handle it, let preferences handle it.
            return super.onPreferenceTreeClick(preferenceScreen, preference);