diff options
author | Danesh M <daneshm90@gmail.com> | 2016-03-09 11:49:57 -0800 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2016-03-14 13:37:13 -0700 |
commit | 9c35338443d9d9d84bbfe4c899d82d2da1f85b60 (patch) | |
tree | cc8debc41a1f437cccbdb53e4efc139e9e272bb6 /src/com/android/settings/livedisplay | |
parent | d8c29b8f2327a2df83e606e286d053cfce28ba16 (diff) | |
download | packages_apps_Settings-9c35338443d9d9d84bbfe4c899d82d2da1f85b60.zip packages_apps_Settings-9c35338443d9d9d84bbfe4c899d82d2da1f85b60.tar.gz packages_apps_Settings-9c35338443d9d9d84bbfe4c899d82d2da1f85b60.tar.bz2 |
Settings : Add multiuser support for CMHardware
- Show button for other users
- Use services instead of CMHardware for vibrator and touch sensitivity
- Do a one time restore of tunable settings
CYNGNOS-1166
Change-Id: I0de8eef6bf73c344ee5789e9650dd96b25b1a6bc
Diffstat (limited to 'src/com/android/settings/livedisplay')
-rw-r--r-- | src/com/android/settings/livedisplay/DisplayGamma.java | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/com/android/settings/livedisplay/DisplayGamma.java b/src/com/android/settings/livedisplay/DisplayGamma.java index e75e3a4..2b44cea 100644 --- a/src/com/android/settings/livedisplay/DisplayGamma.java +++ b/src/com/android/settings/livedisplay/DisplayGamma.java @@ -39,7 +39,9 @@ import android.widget.TextView; import com.android.settings.R; import cyanogenmod.hardware.CMHardwareManager; +import cyanogenmod.providers.CMSettings; +import java.util.ArrayList; import java.util.Arrays; /** @@ -165,7 +167,7 @@ public class DisplayGamma extends DialogPreference { mSeekBars[index][color].setGamma(val); mCurrentColors[index][color] = val; } - mHardware.setDisplayGammaCalibration(index, mCurrentColors[index]); + writeDisplayGamma(getContext(), index, mCurrentColors[index]); } } }); @@ -184,7 +186,7 @@ public class DisplayGamma extends DialogPreference { editor.apply(); } else if (mOriginalColors != null) { for (int i = 0; i < mNumberOfControls; i++) { - mHardware.setDisplayGammaCalibration(i, mOriginalColors[i]); + writeDisplayGamma(getContext(), i, mOriginalColors[i]); } } } @@ -204,7 +206,7 @@ public class DisplayGamma extends DialogPreference { // Restore the old state when the activity or dialog is being paused for (int i = 0; i < mNumberOfControls; i++) { - mHardware.setDisplayGammaCalibration(i, mOriginalColors[i]); + writeDisplayGamma(getContext(), i, mOriginalColors[i]); } mOriginalColors = null; @@ -229,7 +231,7 @@ public class DisplayGamma extends DialogPreference { for (int color = 0; color < BAR_COLORS.length; color++) { mSeekBars[index][color].setGamma(mCurrentColors[index][color]); } - mHardware.setDisplayGammaCalibration(index, mCurrentColors[index]); + writeDisplayGamma(getContext(), index, mCurrentColors[index]); } } @@ -259,7 +261,7 @@ public class DisplayGamma extends DialogPreference { rgb[0] = Integer.valueOf(values[0]); rgb[1] = Integer.valueOf(values[1]); rgb[2] = Integer.valueOf(values[2]); - hardware.setDisplayGammaCalibration(i, rgb); + writeDisplayGamma(context, i, rgb); } } } @@ -311,6 +313,19 @@ public class DisplayGamma extends DialogPreference { }; } + private static void writeDisplayGamma(Context context, int index, int[] entries) { + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < entries.length; i++) { + builder.append(i); + if (i != entries.length - 1) { + builder.append("|"); + } + } + CMSettings.Secure.putString(context.getContentResolver(), + CMSettings.Secure.DISPLAY_GAMMA_CALIBRATION_PREFIX + index, + builder.toString()); + } + private class GammaSeekBar implements SeekBar.OnSeekBarChangeListener { private int mControlIndex; private int mColorIndex; @@ -350,8 +365,7 @@ public class DisplayGamma extends DialogPreference { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { mCurrentColors[mControlIndex][mColorIndex] = progress + mMin; - mHardware.setDisplayGammaCalibration(mControlIndex, - mCurrentColors[mControlIndex]); + writeDisplayGamma(getContext(), mControlIndex, mCurrentColors[mControlIndex]); } mValue.setText(String.valueOf(progress + mMin)); } |