diff options
14 files changed, 835 insertions, 8 deletions
diff --git a/api/cm_current.txt b/api/cm_current.txt index 73de8ed..a93f52f 100644 --- a/api/cm_current.txt +++ b/api/cm_current.txt @@ -455,6 +455,7 @@ package cyanogenmod.hardware { method public android.util.Range<java.lang.Integer> getColorBalanceRange(); method public cyanogenmod.hardware.DisplayMode getCurrentDisplayMode(); method public cyanogenmod.hardware.DisplayMode getDefaultDisplayMode(); + method public cyanogenmod.hardware.HSIC getDefaultPictureAdjustment(); method public int[] getDisplayColorCalibration(); method public int getDisplayColorCalibrationDefault(); method public int getDisplayColorCalibrationMax(); @@ -468,6 +469,8 @@ package cyanogenmod.hardware { method public long getLtoDownloadInterval(); method public java.lang.String getLtoSource(); method public deprecated int getNumGammaControls(); + method public cyanogenmod.hardware.HSIC getPictureAdjustment(); + method public java.util.List<android.util.Range<java.lang.Float>> getPictureAdjustmentRanges(); method public java.lang.String getSerialNumber(); method public int getSupportedFeatures(); method public int getThermalState(); @@ -489,6 +492,7 @@ package cyanogenmod.hardware { method public boolean setDisplayColorCalibration(int[]); method public deprecated boolean setDisplayGammaCalibration(int, int[]); method public boolean setDisplayMode(cyanogenmod.hardware.DisplayMode, boolean); + method public boolean setPictureAdjustment(cyanogenmod.hardware.HSIC); method public boolean setVibratorIntensity(int); method public boolean unRegisterThermalListener(cyanogenmod.hardware.ThermalListenerCallback); method public boolean writePersistentBytes(java.lang.String, byte[]); @@ -505,6 +509,7 @@ package cyanogenmod.hardware { field public static final int FEATURE_KEY_DISABLE = 32; // 0x20 field public static final int FEATURE_LONG_TERM_ORBITS = 64; // 0x40 field public static final int FEATURE_PERSISTENT_STORAGE = 16384; // 0x4000 + field public static final int FEATURE_PICTURE_ADJUSTMENT = 262144; // 0x40000 field public static final int FEATURE_SERIAL_NUMBER = 128; // 0x80 field public static final int FEATURE_SUNLIGHT_ENHANCEMENT = 256; // 0x100 field public static final int FEATURE_TAP_TO_WAKE = 512; // 0x200 @@ -522,6 +527,22 @@ package cyanogenmod.hardware { field public final java.lang.String name; } + public class HSIC implements android.os.Parcelable { + ctor public HSIC(float, float, float, float, float); + method public int describeContents(); + method public java.lang.String flatten(); + method public static cyanogenmod.hardware.HSIC fromFloatArray(float[]); + method public float getContrast(); + method public float getHue(); + method public float getIntensity(); + method public float getSaturation(); + method public float getSaturationThreshold(); + method public float[] toFloatArray(); + method public int[] toRGB(); + method public static cyanogenmod.hardware.HSIC unflattenFrom(java.lang.String) throws java.lang.NumberFormatException; + method public void writeToParcel(android.os.Parcel, int); + } + public abstract interface IThermalListenerCallback implements android.os.IInterface { method public abstract void onThermalChanged(int) throws android.os.RemoteException; } @@ -534,10 +555,11 @@ package cyanogenmod.hardware { } public class LiveDisplayConfig implements android.os.Parcelable { - ctor public LiveDisplayConfig(java.util.BitSet, int, int, int, boolean, boolean, boolean, boolean, android.util.Range<java.lang.Integer>, android.util.Range<java.lang.Integer>); + ctor public LiveDisplayConfig(java.util.BitSet, int, int, int, boolean, boolean, boolean, boolean, android.util.Range<java.lang.Integer>, android.util.Range<java.lang.Integer>, android.util.Range<java.lang.Float>, android.util.Range<java.lang.Float>, android.util.Range<java.lang.Float>, android.util.Range<java.lang.Float>, android.util.Range<java.lang.Float>); method public int describeContents(); method public android.util.Range<java.lang.Integer> getColorBalanceRange(); method public android.util.Range<java.lang.Integer> getColorTemperatureRange(); + method public android.util.Range<java.lang.Float> getContrastRange(); method public boolean getDefaultAutoContrast(); method public boolean getDefaultAutoOutdoorMode(); method public boolean getDefaultCABC(); @@ -545,6 +567,11 @@ package cyanogenmod.hardware { method public int getDefaultDayTemperature(); method public int getDefaultMode(); method public int getDefaultNightTemperature(); + method public android.util.Range<java.lang.Float> getHueRange(); + method public android.util.Range<java.lang.Float> getIntensityRange(); + method public java.util.List<android.util.Range<java.lang.Float>> getPictureAdjustmentRanges(); + method public android.util.Range<java.lang.Float> getSaturationRange(); + method public android.util.Range<java.lang.Float> getSaturationThresholdRange(); method public boolean hasFeature(int); method public boolean hasModeSupport(); method public boolean isAvailable(); @@ -555,9 +582,11 @@ package cyanogenmod.hardware { method public float[] getColorAdjustment(); method public cyanogenmod.hardware.LiveDisplayConfig getConfig(); method public int getDayColorTemperature(); + method public cyanogenmod.hardware.HSIC getDefaultPictureAdjustment(); method public static synchronized cyanogenmod.hardware.LiveDisplayManager getInstance(android.content.Context); method public int getMode(); method public int getNightColorTemperature(); + method public cyanogenmod.hardware.HSIC getPictureAdjustment(); method public boolean isAutoContrastEnabled(); method public boolean isAutomaticOutdoorModeEnabled(); method public boolean isCABCEnabled(); @@ -570,6 +599,11 @@ package cyanogenmod.hardware { method public boolean setDayColorTemperature(int); method public boolean setMode(int); method public boolean setNightColorTemperature(int); + method public boolean setPictureAdjustment(cyanogenmod.hardware.HSIC); + field public static final int ADJUSTMENT_CONTRAST = 3; // 0x3 + field public static final int ADJUSTMENT_HUE = 0; // 0x0 + field public static final int ADJUSTMENT_INTENSITY = 2; // 0x2 + field public static final int ADJUSTMENT_SATURATION = 1; // 0x1 field public static final int FEATURE_AUTO_CONTRAST = 11; // 0xb field public static final int FEATURE_CABC = 10; // 0xa field public static final int FEATURE_COLOR_ADJUSTMENT = 13; // 0xd @@ -577,6 +611,7 @@ package cyanogenmod.hardware { field public static final int FEATURE_COLOR_ENHANCEMENT = 12; // 0xc field public static final int FEATURE_DISPLAY_MODES = 15; // 0xf field public static final int FEATURE_MANAGED_OUTDOOR_MODE = 14; // 0xe + field public static final int FEATURE_PICTURE_ADJUSTMENT = 17; // 0x11 field public static final int MODE_AUTO = 2; // 0x2 field public static final int MODE_DAY = 4; // 0x4 field public static final int MODE_NIGHT = 1; // 0x1 @@ -932,6 +967,7 @@ package cyanogenmod.providers { field public static final java.lang.String DISPLAY_COLOR_ADJUSTMENT = "display_color_adjustment"; field public static final java.lang.String DISPLAY_COLOR_ENHANCE = "display_color_enhance"; field public static final deprecated java.lang.String DISPLAY_LOW_POWER = "display_low_power"; + field public static final java.lang.String DISPLAY_PICTURE_ADJUSTMENT = "display_picture_adjustment"; field public static final java.lang.String DISPLAY_TEMPERATURE_DAY = "display_temperature_day"; field public static final java.lang.String DISPLAY_TEMPERATURE_MODE = "display_temperature_mode"; field public static final java.lang.String DISPLAY_TEMPERATURE_NIGHT = "display_temperature_night"; diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/CMHardwareService.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/CMHardwareService.java index 9fa1269..bd9071b 100644 --- a/cm/lib/main/java/org/cyanogenmod/platform/internal/CMHardwareService.java +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/CMHardwareService.java @@ -22,6 +22,7 @@ import android.os.RemoteCallbackList; import android.os.RemoteException; import android.util.ArrayMap; import android.util.Log; +import android.util.Range; import com.android.server.SystemService; @@ -31,10 +32,12 @@ import cyanogenmod.hardware.CMHardwareManager; import cyanogenmod.hardware.DisplayMode; import cyanogenmod.hardware.IThermalListenerCallback; import cyanogenmod.hardware.ThermalListenerCallback; +import cyanogenmod.hardware.HSIC; import java.io.File; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import org.cyanogenmod.hardware.AdaptiveBacklight; import org.cyanogenmod.hardware.AutoContrast; @@ -47,6 +50,7 @@ import org.cyanogenmod.hardware.HighTouchSensitivity; import org.cyanogenmod.hardware.KeyDisabler; import org.cyanogenmod.hardware.LongTermOrbits; import org.cyanogenmod.hardware.PersistentStorage; +import org.cyanogenmod.hardware.PictureAdjustment; import org.cyanogenmod.hardware.SerialNumber; import org.cyanogenmod.hardware.SunlightEnhancement; import org.cyanogenmod.hardware.TapToWake; @@ -108,6 +112,11 @@ public class CMHardwareService extends CMSystemService implements ThermalUpdateC public int getColorBalanceMax(); public int getColorBalance(); public boolean setColorBalance(int value); + + public HSIC getPictureAdjustment(); + public HSIC getDefaultPictureAdjustment(); + public boolean setPictureAdjustment(HSIC hsic); + public List<Range<Float>> getPictureAdjustmentRanges(); } private class LegacyCMHardware implements CMHardwareInterface { @@ -151,6 +160,8 @@ public class CMHardwareService extends CMSystemService implements ThermalUpdateC mSupportedFeatures |= CMHardwareManager.FEATURE_UNIQUE_DEVICE_ID; if (ColorBalance.isSupported()) mSupportedFeatures |= CMHardwareManager.FEATURE_COLOR_BALANCE; + if (PictureAdjustment.isSupported()) + mSupportedFeatures |= CMHardwareManager.FEATURE_PICTURE_ADJUSTMENT; } public int getSupportedFeatures() { @@ -364,6 +375,21 @@ public class CMHardwareService extends CMSystemService implements ThermalUpdateC public boolean setColorBalance(int value) { return ColorBalance.setValue(value); } + + public HSIC getPictureAdjustment() { return PictureAdjustment.getHSIC(); } + + public HSIC getDefaultPictureAdjustment() { return PictureAdjustment.getDefaultHSIC(); } + + public boolean setPictureAdjustment(HSIC hsic) { return PictureAdjustment.setHSIC(hsic); } + + public List<Range<Float>> getPictureAdjustmentRanges() { + return Arrays.asList( + PictureAdjustment.getHueRange(), + PictureAdjustment.getSaturationRange(), + PictureAdjustment.getIntensityRange(), + PictureAdjustment.getContrastRange(), + PictureAdjustment.getSaturationThresholdRange()); + } } private CMHardwareInterface getImpl(Context context) { @@ -794,5 +820,51 @@ public class CMHardwareService extends CMSystemService implements ThermalUpdateC } return false; } + + @Override + public HSIC getPictureAdjustment() { + mContext.enforceCallingOrSelfPermission( + cyanogenmod.platform.Manifest.permission.HARDWARE_ABSTRACTION_ACCESS, null); + if (isSupported(CMHardwareManager.FEATURE_PICTURE_ADJUSTMENT)) { + return mCmHwImpl.getPictureAdjustment(); + } + return new HSIC(0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + } + + @Override + public HSIC getDefaultPictureAdjustment() { + mContext.enforceCallingOrSelfPermission( + cyanogenmod.platform.Manifest.permission.HARDWARE_ABSTRACTION_ACCESS, null); + if (isSupported(CMHardwareManager.FEATURE_PICTURE_ADJUSTMENT)) { + return mCmHwImpl.getDefaultPictureAdjustment(); + } + return new HSIC(0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + } + + @Override + public boolean setPictureAdjustment(HSIC hsic) { + mContext.enforceCallingOrSelfPermission( + cyanogenmod.platform.Manifest.permission.HARDWARE_ABSTRACTION_ACCESS, null); + if (isSupported(CMHardwareManager.FEATURE_PICTURE_ADJUSTMENT) && hsic != null) { + return mCmHwImpl.setPictureAdjustment(hsic); + } + return false; + } + + @Override + public float[] getPictureAdjustmentRanges() { + mContext.enforceCallingOrSelfPermission( + cyanogenmod.platform.Manifest.permission.HARDWARE_ABSTRACTION_ACCESS, null); + if (isSupported(CMHardwareManager.FEATURE_COLOR_BALANCE)) { + final List<Range<Float>> r = mCmHwImpl.getPictureAdjustmentRanges(); + return new float[] { + r.get(0).getLower(), r.get(0).getUpper(), + r.get(1).getLower(), r.get(1).getUpper(), + r.get(2).getLower(), r.get(2).getUpper(), + r.get(3).getLower(), r.get(3).getUpper(), + r.get(4).getUpper(), r.get(4).getUpper() }; + } + return new float[10]; + } }; } diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/display/LiveDisplayService.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/display/LiveDisplayService.java index 7fe5656..6b82120 100644 --- a/cm/lib/main/java/org/cyanogenmod/platform/internal/display/LiveDisplayService.java +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/display/LiveDisplayService.java @@ -65,6 +65,7 @@ import java.util.List; import cyanogenmod.app.CMContextConstants; import cyanogenmod.app.CMStatusBarManager; import cyanogenmod.app.CustomTile; +import cyanogenmod.hardware.HSIC; import cyanogenmod.hardware.ILiveDisplayService; import cyanogenmod.hardware.LiveDisplayConfig; import cyanogenmod.providers.CMSettings; @@ -98,6 +99,7 @@ public class LiveDisplayService extends CMSystemService { private ColorTemperatureController mCTC; private DisplayHardwareController mDHC; private OutdoorModeController mOMC; + private PictureAdjustmentController mPAC; private LiveDisplayConfig mConfig; @@ -175,6 +177,9 @@ public class LiveDisplayService extends CMSystemService { mOMC = new OutdoorModeController(mContext, mHandler); mFeatures.add(mOMC); + mPAC = new PictureAdjustmentController(mContext, mHandler); + mFeatures.add(mPAC); + // Get capabilities, throw out any unused features final BitSet capabilities = new BitSet(); for (Iterator<LiveDisplayFeature> it = mFeatures.iterator(); it.hasNext();) { @@ -192,7 +197,10 @@ public class LiveDisplayService extends CMSystemService { mCTC.getDefaultDayTemperature(), mCTC.getDefaultNightTemperature(), mOMC.getDefaultAutoOutdoorMode(), mDHC.getDefaultAutoContrast(), mDHC.getDefaultCABC(), mDHC.getDefaultColorEnhancement(), - mCTC.getColorTemperatureRange(), mCTC.getColorBalanceRange()); + mCTC.getColorTemperatureRange(), mCTC.getColorBalanceRange(), + mPAC.getHueRange(), mPAC.getSaturationRange(), + mPAC.getIntensityRange(), mPAC.getContrastRange(), + mPAC.getSaturationThresholdRange()); // listeners mDisplayManager = (DisplayManager) getContext().getSystemService( @@ -471,6 +479,15 @@ public class LiveDisplayService extends CMSystemService { } @Override + public HSIC getPictureAdjustment() { return mPAC.getPictureAdjustment(); } + + @Override + public boolean setPictureAdjustment(final HSIC hsic) { return mPAC.setPictureAdjustment(hsic); } + + @Override + public HSIC getDefaultPictureAdjustment() { return mPAC.getDefaultPictureAdjustment(); } + + @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG); diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/display/PictureAdjustmentController.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/display/PictureAdjustmentController.java new file mode 100644 index 0000000..5cb08b2 --- /dev/null +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/display/PictureAdjustmentController.java @@ -0,0 +1,242 @@ +/* + * Copyright (C) 2016 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.cyanogenmod.platform.internal.display; + +import android.content.Context; +import android.net.Uri; +import android.os.Handler; +import android.text.TextUtils; +import android.util.Range; +import android.util.Slog; +import android.util.SparseArray; +import android.view.Display; + +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.List; + +import cyanogenmod.hardware.CMHardwareManager; +import cyanogenmod.hardware.DisplayMode; +import cyanogenmod.hardware.HSIC; +import cyanogenmod.hardware.LiveDisplayManager; +import cyanogenmod.providers.CMSettings; + +public class PictureAdjustmentController extends LiveDisplayFeature { + + private static final String TAG = "LiveDisplay-PAC"; + + private final CMHardwareManager mHardware; + private final boolean mUsePictureAdjustment; + private final boolean mHasDisplayModes; + + private List<Range<Float>> mRanges = new ArrayList<Range<Float>>(); + + public PictureAdjustmentController(Context context, Handler handler) { + super(context, handler); + mHardware = CMHardwareManager.getInstance(context); + mHasDisplayModes = mHardware.isSupported(CMHardwareManager.FEATURE_DISPLAY_MODES); + + boolean usePA = mHardware.isSupported(CMHardwareManager.FEATURE_PICTURE_ADJUSTMENT); + if (usePA) { + mRanges.addAll(mHardware.getPictureAdjustmentRanges()); + if (mRanges.size() < 4) { + usePA = false; + } else { + for (Range<Float> range : mRanges) { + if (range.getLower() == 0.0f && range.getUpper() == 0.0f) { + usePA = false; + break; + } + } + } + } + if (!usePA) { + mRanges.clear(); + } + mUsePictureAdjustment = usePA; + } + + @Override + public void onStart() { + if (!mUsePictureAdjustment) { + return; + } + + registerSettings( + CMSettings.System.getUriFor(CMSettings.System.DISPLAY_PICTURE_ADJUSTMENT)); + } + + @Override + protected void onSettingsChanged(Uri uri) {// nothing to do for mode switch + updatePictureAdjustment(); + } + + @Override + protected void onUpdate() { + updatePictureAdjustment(); + } + + private void updatePictureAdjustment() { + if (mUsePictureAdjustment && isScreenOn()) { + final HSIC hsic = getPictureAdjustment(); + if (hsic != null) { + if (!mHardware.setPictureAdjustment(hsic)) { + Slog.e(TAG, "Failed to set picture adjustment! " + hsic.toString()); + } + } + } + } + + @Override + public void dump(PrintWriter pw) { + if (mUsePictureAdjustment) { + pw.println(); + pw.println("PictureAdjustmentController Configuration:"); + pw.println(" adjustment=" + getPictureAdjustment()); + pw.println(" hueRange=" + getHueRange()); + pw.println(" saturationRange=" + getSaturationRange()); + pw.println(" intensityRange=" + getIntensityRange()); + pw.println(" contrastRange=" + getContrastRange()); + pw.println(" saturationThresholdRange=" + getSaturationThresholdRange()); + pw.println(" defaultAdjustment=" + getDefaultPictureAdjustment()); + } + } + + + @Override + public boolean getCapabilities(BitSet caps) { + if (mUsePictureAdjustment) { + caps.set(LiveDisplayManager.FEATURE_PICTURE_ADJUSTMENT); + } + return mUsePictureAdjustment; + } + + Range<Float> getHueRange() { + return mUsePictureAdjustment && mRanges.size() > 0 + ? mRanges.get(0) : Range.create(0.0f, 0.0f); + } + + Range<Float> getSaturationRange() { + return mUsePictureAdjustment && mRanges.size() > 1 + ? mRanges.get(1) : Range.create(0.0f, 0.0f); + } + + Range<Float> getIntensityRange() { + return mUsePictureAdjustment && mRanges.size() > 2 + ? mRanges.get(2) : Range.create(0.0f, 0.0f); + } + + Range<Float> getContrastRange() { + return mUsePictureAdjustment && mRanges.size() > 3 ? + mRanges.get(3) : Range.create(0.0f, 0.0f); + } + + Range<Float> getSaturationThresholdRange() { + return mUsePictureAdjustment && mRanges.size() > 4 ? + mRanges.get(4) : Range.create(0.0f, 0.0f); + } + + HSIC getDefaultPictureAdjustment() { + HSIC hsic = null; + if (mUsePictureAdjustment) { + hsic = mHardware.getDefaultPictureAdjustment(); + } + if (hsic == null) { + hsic = new HSIC(0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + } + return hsic; + } + + HSIC getPictureAdjustment() { + HSIC hsic = null; + if (mUsePictureAdjustment) { + int modeID = 0; + if (mHasDisplayModes) { + DisplayMode mode = mHardware.getCurrentDisplayMode(); + if (mode != null) { + modeID = mode.id; + } + } + hsic = getPAForMode(modeID); + } + if (hsic == null) { + hsic = new HSIC(0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + } + return hsic; + } + + boolean setPictureAdjustment(HSIC hsic) { + if (mUsePictureAdjustment && hsic != null) { + int modeID = 0; + if (mHasDisplayModes) { + DisplayMode mode = mHardware.getCurrentDisplayMode(); + if (mode != null) { + modeID = mode.id; + } + } + setPAForMode(modeID, hsic); + return true; + } + return false; + } + + // TODO: Expose mode-based settings to upper layers + + private HSIC getPAForMode(int mode) { + final SparseArray<HSIC> prefs = unpackPreference(); + if (prefs.indexOfKey(mode) >= 0) { + return prefs.get(mode); + } + return getDefaultPictureAdjustment(); + } + + private void setPAForMode(int mode, HSIC hsic) { + final SparseArray<HSIC> prefs = unpackPreference(); + prefs.put(mode, hsic); + packPreference(prefs); + } + + private SparseArray<HSIC> unpackPreference() { + final SparseArray<HSIC> ret = new SparseArray<HSIC>(); + + String pref = getString(CMSettings.System.DISPLAY_PICTURE_ADJUSTMENT); + if (pref != null) { + String[] byMode = TextUtils.split(pref, ","); + for (String mode : byMode) { + String[] modePA = TextUtils.split(mode, ":"); + if (modePA.length == 2) { + ret.put(Integer.valueOf(modePA[0]), HSIC.unflattenFrom(modePA[1])); + } + } + } + return ret; + } + + private void packPreference(final SparseArray<HSIC> modes) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < modes.size(); i++) { + int id = modes.keyAt(i); + HSIC m = modes.get(id); + if (i > 0) { + sb.append(","); + } + sb.append(id).append(":").append(m.flatten()); + } + putString(CMSettings.System.DISPLAY_PICTURE_ADJUSTMENT, sb.toString()); + } + +} diff --git a/sdk/src/java/cyanogenmod/hardware/CMHardwareManager.java b/sdk/src/java/cyanogenmod/hardware/CMHardwareManager.java index d31ce9b..5f60443 100644 --- a/sdk/src/java/cyanogenmod/hardware/CMHardwareManager.java +++ b/sdk/src/java/cyanogenmod/hardware/CMHardwareManager.java @@ -23,6 +23,7 @@ import android.util.Log; import android.util.Range; import cyanogenmod.app.CMContextConstants; +import cyanogenmod.hardware.HSIC; import java.io.UnsupportedEncodingException; import java.lang.IllegalArgumentException; @@ -135,6 +136,12 @@ public final class CMHardwareManager { */ public static final int FEATURE_COLOR_BALANCE = 0x20000; + /** + * HSIC picture adjustment + */ + public static final int FEATURE_PICTURE_ADJUSTMENT = 0x40000; + + private static final List<Integer> BOOLEAN_FEATURES = Arrays.asList( FEATURE_ADAPTIVE_BACKLIGHT, FEATURE_COLOR_ENHANCEMENT, @@ -809,6 +816,9 @@ public final class CMHardwareManager { return false; } + /** + * @return the available range for color temperature adjustments + */ public Range<Integer> getColorBalanceRange() { int min = 0; int max = 0; @@ -822,6 +832,9 @@ public final class CMHardwareManager { return new Range<Integer>(min, max); } + /** + * @return the current color balance value + */ public int getColorBalance() { try { if (checkService()) { @@ -832,6 +845,13 @@ public final class CMHardwareManager { return 0; } + /** + * Sets the desired color balance. Must fall within the range obtained from + * getColorBalanceRange() + * + * @param value + * @return true if success + */ public boolean setColorBalance(int value) { try { if (checkService()) { @@ -843,6 +863,76 @@ public final class CMHardwareManager { } /** + * Gets the current picture adjustment values + * + * @return HSIC object with current settings + */ + public HSIC getPictureAdjustment() { + try { + if (checkService()) { + return sService.getPictureAdjustment(); + } + } catch (RemoteException e) { + } + return null; + } + + /** + * Gets the default picture adjustment for the current mode + * + * @return HSIC object with default settings + */ + public HSIC getDefaultPictureAdjustment() { + try { + if (checkService()) { + return sService.getDefaultPictureAdjustment(); + } + } catch (RemoteException e) { + } + return null; + } + + /** + * Sets the desired hue/saturation/intensity/contrast + * + * @param hsic + * @return true if success + */ + public boolean setPictureAdjustment(final HSIC hsic) { + try { + if (checkService()) { + return sService.setPictureAdjustment(hsic); + } + } catch (RemoteException e) { + } + return false; + } + + /** + * Get a list of ranges valid for picture adjustment. + * + * @return range list + */ + public List<Range<Float>> getPictureAdjustmentRanges() { + try { + if (checkService()) { + float[] ranges = sService.getPictureAdjustmentRanges(); + if (ranges.length > 7) { + return Arrays.asList(new Range<Float>(ranges[0], ranges[1]), + new Range<Float>(ranges[2], ranges[3]), + new Range<Float>(ranges[4], ranges[5]), + new Range<Float>(ranges[6], ranges[7]), + (ranges.length > 9 ? + new Range<Float>(ranges[8], ranges[9]) : + new Range<Float>(0.0f, 0.0f))); + } + } + } catch (RemoteException e) { + } + return null; + } + + /** * @return true if service is valid */ private boolean checkService() { diff --git a/sdk/src/java/cyanogenmod/hardware/HSIC.aidl b/sdk/src/java/cyanogenmod/hardware/HSIC.aidl new file mode 100644 index 0000000..1689ee6 --- /dev/null +++ b/sdk/src/java/cyanogenmod/hardware/HSIC.aidl @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2015 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cyanogenmod.hardware; + +parcelable HSIC; diff --git a/sdk/src/java/cyanogenmod/hardware/HSIC.java b/sdk/src/java/cyanogenmod/hardware/HSIC.java new file mode 100644 index 0000000..cd4f3ce --- /dev/null +++ b/sdk/src/java/cyanogenmod/hardware/HSIC.java @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2016 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package cyanogenmod.hardware; + +import android.graphics.Color; +import android.os.Parcel; +import android.os.Parcelable; + +import android.text.TextUtils; + +public class HSIC implements Parcelable { + + private final float mHue; + private final float mSaturation; + private final float mIntensity; + private final float mContrast; + private final float mSaturationThreshold; + + public HSIC(float hue, float saturation, float intensity, + float contrast, float saturationThreshold) { + mHue = hue; + mSaturation = saturation; + mIntensity = intensity; + mContrast = contrast; + mSaturationThreshold = saturationThreshold; + } + + public float getHue() { + return mHue; + } + + public float getSaturation() { + return mSaturation; + } + + public float getIntensity() { + return mIntensity; + } + + public float getContrast() { + return mContrast; + } + + public float getSaturationThreshold() { + return mSaturationThreshold; + } + + public String flatten() { + return String.format("%f|%f|%f|%f|%f", mHue, mSaturation, + mIntensity, mContrast, mSaturationThreshold); + } + + public static HSIC unflattenFrom(String flat) throws NumberFormatException { + final String[] unflat = TextUtils.split(flat, "\\|"); + if (unflat.length != 4 && unflat.length != 5) { + throw new NumberFormatException("Failed to unflatten HSIC values: " + flat); + } + return new HSIC(Float.valueOf(unflat[0]), Float.valueOf(unflat[1]), + Float.valueOf(unflat[2]), Float.valueOf(unflat[3]), + unflat.length == 5 ? Float.valueOf(unflat[4]) : 0.0f); + } + + public int[] toRGB() { + final int c = Color.HSVToColor(toFloatArray()); + return new int[] { Color.red(c), Color.green(c), Color.blue(c) }; + } + + public float[] toFloatArray() { + return new float[] { mHue, mSaturation, mIntensity, mContrast, mSaturationThreshold }; + } + + public static HSIC fromFloatArray(float[] hsic) { + if (hsic.length == 5) { + return new HSIC(hsic[0], hsic[1], hsic[2], hsic[3], hsic[4]); + } else if (hsic.length == 4) { + return new HSIC(hsic[0], hsic[1], hsic[2], hsic[3], 0.0f); + } + return null; + } + + @Override + public String toString() { + return String.format("HSIC={ hue=%f saturation=%f intensity=%f " + + "contrast=%f saturationThreshold=%f }", + mHue, mSaturation, mIntensity, mContrast, mSaturationThreshold); + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel parcel, int i) { + parcel.writeFloatArray(toFloatArray()); + } + + /** + * @hide + */ + public static final Parcelable.Creator<HSIC> CREATOR = + new Parcelable.Creator<HSIC>() { + public HSIC createFromParcel(Parcel in) { + float[] fromParcel = new float[5]; + in.readFloatArray(fromParcel); + return HSIC.fromFloatArray(fromParcel); + } + + @Override + public HSIC[] newArray(int size) { + return new HSIC[size]; + } + }; +}; diff --git a/sdk/src/java/cyanogenmod/hardware/ICMHardwareService.aidl b/sdk/src/java/cyanogenmod/hardware/ICMHardwareService.aidl index 6fbaf66..3208ddb 100644 --- a/sdk/src/java/cyanogenmod/hardware/ICMHardwareService.aidl +++ b/sdk/src/java/cyanogenmod/hardware/ICMHardwareService.aidl @@ -17,6 +17,7 @@ package cyanogenmod.hardware; import cyanogenmod.hardware.DisplayMode; +import cyanogenmod.hardware.HSIC; import cyanogenmod.hardware.IThermalListenerCallback; /** @hide */ @@ -63,4 +64,10 @@ interface ICMHardwareService { int getColorBalanceMax(); int getColorBalance(); boolean setColorBalance(int value); + + HSIC getPictureAdjustment(); + HSIC getDefaultPictureAdjustment(); + boolean setPictureAdjustment(in HSIC hsic); + float[] getPictureAdjustmentRanges(); + } diff --git a/sdk/src/java/cyanogenmod/hardware/ILiveDisplayService.aidl b/sdk/src/java/cyanogenmod/hardware/ILiveDisplayService.aidl index 68e2b86..3c9c971 100644 --- a/sdk/src/java/cyanogenmod/hardware/ILiveDisplayService.aidl +++ b/sdk/src/java/cyanogenmod/hardware/ILiveDisplayService.aidl @@ -16,6 +16,7 @@ package cyanogenmod.hardware; +import cyanogenmod.hardware.HSIC; import cyanogenmod.hardware.LiveDisplayConfig; /** @hide */ @@ -47,4 +48,8 @@ interface ILiveDisplayService { boolean isAutomaticOutdoorModeEnabled(); boolean setAutomaticOutdoorModeEnabled(boolean enabled); + + HSIC getPictureAdjustment(); + HSIC getDefaultPictureAdjustment(); + boolean setPictureAdjustment(in HSIC adj); } diff --git a/sdk/src/java/cyanogenmod/hardware/LiveDisplayConfig.java b/sdk/src/java/cyanogenmod/hardware/LiveDisplayConfig.java index 81cdca3..dae3db8 100644 --- a/sdk/src/java/cyanogenmod/hardware/LiveDisplayConfig.java +++ b/sdk/src/java/cyanogenmod/hardware/LiveDisplayConfig.java @@ -15,6 +15,7 @@ */ package cyanogenmod.hardware; +import static cyanogenmod.hardware.LiveDisplayManager.FEATURE_COLOR_BALANCE; import static cyanogenmod.hardware.LiveDisplayManager.FEATURE_FIRST; import static cyanogenmod.hardware.LiveDisplayManager.FEATURE_LAST; import static cyanogenmod.hardware.LiveDisplayManager.MODE_FIRST; @@ -25,7 +26,9 @@ import android.os.Parcel; import android.os.Parcelable; import android.util.Range; +import java.util.Arrays; import java.util.BitSet; +import java.util.List; import cyanogenmod.os.Build; import cyanogenmod.os.Concierge; @@ -53,13 +56,23 @@ public class LiveDisplayConfig implements Parcelable { private final Range<Integer> mColorTemperatureRange; private final Range<Integer> mColorBalanceRange; + private final Range<Float> mHueRange; + private final Range<Float> mSaturationRange; + private final Range<Float> mIntensityRange; + private final Range<Float> mContrastRange; + private final Range<Float> mSaturationThresholdRange; public LiveDisplayConfig(BitSet capabilities, int defaultMode, int defaultDayTemperature, int defaultNightTemperature, boolean defaultAutoOutdoorMode, boolean defaultAutoContrast, boolean defaultCABC, boolean defaultColorEnhancement, Range<Integer> colorTemperatureRange, - Range<Integer> colorBalanceRange) { + Range<Integer> colorBalanceRange, + Range<Float> hueRange, + Range<Float> saturationRange, + Range<Float> intensityRange, + Range<Float> contrastRange, + Range<Float> saturationThresholdRange) { super(); mCapabilities = (BitSet) capabilities.clone(); mAllModes.set(MODE_FIRST, MODE_LAST); @@ -72,6 +85,11 @@ public class LiveDisplayConfig implements Parcelable { mDefaultColorEnhancement = defaultColorEnhancement; mColorTemperatureRange = colorTemperatureRange; mColorBalanceRange = colorBalanceRange; + mHueRange = hueRange; + mSaturationRange = saturationRange; + mIntensityRange = intensityRange; + mContrastRange = contrastRange; + mSaturationThresholdRange = saturationThresholdRange; } private LiveDisplayConfig(Parcel parcel) { @@ -92,6 +110,7 @@ public class LiveDisplayConfig implements Parcelable { int maxColorTemperature = 0; int minColorBalance = 0; int maxColorBalance = 0; + float[] paRanges = new float[10]; if (parcelableVersion >= Build.CM_VERSION_CODES.FIG) { capabilities = parcel.readLong(); @@ -106,6 +125,7 @@ public class LiveDisplayConfig implements Parcelable { maxColorTemperature = parcel.readInt(); minColorBalance = parcel.readInt(); maxColorBalance = parcel.readInt(); + parcel.readFloatArray(paRanges); } // set temps @@ -120,6 +140,11 @@ public class LiveDisplayConfig implements Parcelable { mDefaultColorEnhancement = defaultColorEnhancement; mColorTemperatureRange = Range.create(minColorTemperature, maxColorTemperature); mColorBalanceRange = Range.create(minColorBalance, maxColorBalance); + mHueRange = Range.create(paRanges[0], paRanges[1]); + mSaturationRange = Range.create(paRanges[2], paRanges[3]); + mIntensityRange = Range.create(paRanges[4], paRanges[5]); + mContrastRange = Range.create(paRanges[6], paRanges[7]); + mSaturationThresholdRange = Range.create(paRanges[8], paRanges[9]); // Complete parcel info for the concierge parcelInfo.complete(); @@ -137,7 +162,16 @@ public class LiveDisplayConfig implements Parcelable { sb.append(" defaultCABC=").append(mDefaultCABC); sb.append(" defaultColorEnhancement=").append(mDefaultColorEnhancement); sb.append(" colorTemperatureRange=").append(mColorTemperatureRange); - sb.append(" colorBalanceRange=").append(mColorBalanceRange); + if (mCapabilities.get(LiveDisplayManager.FEATURE_COLOR_BALANCE)) { + sb.append(" colorBalanceRange=").append(mColorBalanceRange); + } + if (mCapabilities.get(LiveDisplayManager.FEATURE_PICTURE_ADJUSTMENT)) { + sb.append(" hueRange=").append(mHueRange); + sb.append(" saturationRange=").append(mSaturationRange); + sb.append(" intensityRange=").append(mIntensityRange); + sb.append(" contrastRange=").append(mContrastRange); + sb.append(" saturationThresholdRange=").append(mSaturationThresholdRange); + } return sb.toString(); } @@ -165,6 +199,12 @@ public class LiveDisplayConfig implements Parcelable { out.writeInt(mColorTemperatureRange.getUpper()); out.writeInt(mColorBalanceRange.getLower()); out.writeInt(mColorBalanceRange.getUpper()); + out.writeFloatArray(new float[] { + mHueRange.getLower(), mHueRange.getUpper(), + mSaturationRange.getLower(), mSaturationRange.getUpper(), + mIntensityRange.getLower(), mIntensityRange.getUpper(), + mContrastRange.getLower(), mContrastRange.getUpper(), + mSaturationThresholdRange.getLower(), mSaturationThresholdRange.getUpper() } ); // Complete the parcel info for the concierge parcelInfo.complete(); @@ -285,6 +325,55 @@ public class LiveDisplayConfig implements Parcelable { return mColorBalanceRange; } + /** + * Get the supported range for hue adjustment + * + * @return float range + */ + public Range<Float> getHueRange() { return mHueRange; } + + /** + * Get the supported range for saturation adjustment + * + * @return float range + */ + public Range<Float> getSaturationRange() { return mSaturationRange; } + + /** + * Get the supported range for intensity adjustment + * + * @return float range + */ + public Range<Float> getIntensityRange() { return mIntensityRange; } + + /** + * Get the supported range for contrast adjustment + * + * @return float range + */ + public Range<Float> getContrastRange() { return mContrastRange; } + + /** + * Get the supported range for saturation threshold adjustment + * + * @return float range + */ + public Range<Float> getSaturationThresholdRange() { + return mSaturationThresholdRange; + } + + + /** + * Convenience method to get a list of all picture adjustment ranges + * with a single call. + * + * @return List of float ranges + */ + public List<Range<Float>> getPictureAdjustmentRanges() { + return Arrays.asList(mHueRange, mSaturationRange, mIntensityRange, + mContrastRange, mSaturationThresholdRange); + } + /** @hide */ public static final Parcelable.Creator<LiveDisplayConfig> CREATOR = new Parcelable.Creator<LiveDisplayConfig>() { diff --git a/sdk/src/java/cyanogenmod/hardware/LiveDisplayManager.java b/sdk/src/java/cyanogenmod/hardware/LiveDisplayManager.java index 5a39a98..cfe904f 100644 --- a/sdk/src/java/cyanogenmod/hardware/LiveDisplayManager.java +++ b/sdk/src/java/cyanogenmod/hardware/LiveDisplayManager.java @@ -20,6 +20,11 @@ import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; +import android.util.Range; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import cyanogenmod.app.CMContextConstants; @@ -109,10 +114,21 @@ public class LiveDisplayManager { */ public static final int FEATURE_COLOR_BALANCE = 16; + /** + * System supports manual hue/saturation/intensity/contrast + * adjustment of display. + */ + public static final int FEATURE_PICTURE_ADJUSTMENT = 17; + + public static final int ADJUSTMENT_HUE = 0; + public static final int ADJUSTMENT_SATURATION = 1; + public static final int ADJUSTMENT_INTENSITY = 2; + public static final int ADJUSTMENT_CONTRAST = 3; + /** @hide */ public static final int FEATURE_FIRST = FEATURE_CABC; /** @hide */ - public static final int FEATURE_LAST = FEATURE_COLOR_BALANCE; + public static final int FEATURE_LAST = FEATURE_PICTURE_ADJUSTMENT; private static final String TAG = "LiveDisplay"; @@ -422,4 +438,48 @@ public class LiveDisplayManager { return false; } } + + /** + * Gets the current picture adjustment settings (hue, saturation, intensity, contrast) + * + * @return HSIC object with current settings + */ + public HSIC getPictureAdjustment() { + try { + if (checkService()) { + return sService.getPictureAdjustment(); + } + } catch (RemoteException e) { + } + return null; + } + + /** + * Sets a new picture adjustment + * + * @param hsic + * @return true if success + */ + public boolean setPictureAdjustment(final HSIC hsic) { + try { + return checkService() && sService.setPictureAdjustment(hsic); + } catch (RemoteException e) { + } + return false; + } + + /** + * Gets the default picture adjustment for the current display mode + * + * @return HSIC object with default values + */ + public HSIC getDefaultPictureAdjustment() { + try { + if (checkService()) { + return sService.getDefaultPictureAdjustment(); + } + } catch (RemoteException e) { + } + return null; + } } diff --git a/sdk/src/java/cyanogenmod/providers/CMSettings.java b/sdk/src/java/cyanogenmod/providers/CMSettings.java index 528518f..6e21ed2 100644 --- a/sdk/src/java/cyanogenmod/providers/CMSettings.java +++ b/sdk/src/java/cyanogenmod/providers/CMSettings.java @@ -1823,6 +1823,31 @@ public final class CMSettings { sBooleanValidator; /** + * The current custom picture adjustment values as a delimited string + */ + public static final String DISPLAY_PICTURE_ADJUSTMENT = + "display_picture_adjustment"; + + /** @hide */ + public static final Validator DISPLAY_PICTURE_ADJUSTMENT_VALIDATOR = + new Validator() { + @Override + public boolean validate(String value) { + if (TextUtils.isEmpty(value)) { + return true; + } + final String[] sp = TextUtils.split(value, ","); + for (String s : sp) { + final String[] sp2 = TextUtils.split(s, ":"); + if (sp2.length != 2) { + return false; + } + } + return true; + } + }; + + /** * I can haz more bukkits * @hide */ @@ -2087,6 +2112,8 @@ public final class CMSettings { VALIDATORS.put(ZEN_PRIORITY_ALLOW_LIGHTS, ZEN_PRIORITY_ALLOW_LIGHTS_VALIDATOR); VALIDATORS.put(TOUCHSCREEN_GESTURE_HAPTIC_FEEDBACK, TOUCHSCREEN_GESTURE_HAPTIC_FEEDBACK_VALIDATOR); + VALIDATORS.put(DISPLAY_PICTURE_ADJUSTMENT, + DISPLAY_PICTURE_ADJUSTMENT_VALIDATOR); VALIDATORS.put(__MAGICAL_TEST_PASSING_ENABLER, __MAGICAL_TEST_PASSING_ENABLER_VALIDATOR); }; diff --git a/sdk/src/java/cyanogenmod/util/ColorUtils.java b/sdk/src/java/cyanogenmod/util/ColorUtils.java index 0142396..a5633ff 100644 --- a/sdk/src/java/cyanogenmod/util/ColorUtils.java +++ b/sdk/src/java/cyanogenmod/util/ColorUtils.java @@ -307,8 +307,8 @@ public class ColorUtils { * Convert a color temperature value (in Kelvin) to a RGB units as floats. * This can be used in a transform matrix or hardware gamma control. * - * @param tempK - * @return + * @param degreesK + * @return array of floats representing rgb values 0->1 */ public static float[] temperatureToRGB(int degreesK) { int k = MathUtils.constrain(degreesK, 1000, 20000); diff --git a/system-api/cm_system-current.txt b/system-api/cm_system-current.txt index 73de8ed..a93f52f 100644 --- a/system-api/cm_system-current.txt +++ b/system-api/cm_system-current.txt @@ -455,6 +455,7 @@ package cyanogenmod.hardware { method public android.util.Range<java.lang.Integer> getColorBalanceRange(); method public cyanogenmod.hardware.DisplayMode getCurrentDisplayMode(); method public cyanogenmod.hardware.DisplayMode getDefaultDisplayMode(); + method public cyanogenmod.hardware.HSIC getDefaultPictureAdjustment(); method public int[] getDisplayColorCalibration(); method public int getDisplayColorCalibrationDefault(); method public int getDisplayColorCalibrationMax(); @@ -468,6 +469,8 @@ package cyanogenmod.hardware { method public long getLtoDownloadInterval(); method public java.lang.String getLtoSource(); method public deprecated int getNumGammaControls(); + method public cyanogenmod.hardware.HSIC getPictureAdjustment(); + method public java.util.List<android.util.Range<java.lang.Float>> getPictureAdjustmentRanges(); method public java.lang.String getSerialNumber(); method public int getSupportedFeatures(); method public int getThermalState(); @@ -489,6 +492,7 @@ package cyanogenmod.hardware { method public boolean setDisplayColorCalibration(int[]); method public deprecated boolean setDisplayGammaCalibration(int, int[]); method public boolean setDisplayMode(cyanogenmod.hardware.DisplayMode, boolean); + method public boolean setPictureAdjustment(cyanogenmod.hardware.HSIC); method public boolean setVibratorIntensity(int); method public boolean unRegisterThermalListener(cyanogenmod.hardware.ThermalListenerCallback); method public boolean writePersistentBytes(java.lang.String, byte[]); @@ -505,6 +509,7 @@ package cyanogenmod.hardware { field public static final int FEATURE_KEY_DISABLE = 32; // 0x20 field public static final int FEATURE_LONG_TERM_ORBITS = 64; // 0x40 field public static final int FEATURE_PERSISTENT_STORAGE = 16384; // 0x4000 + field public static final int FEATURE_PICTURE_ADJUSTMENT = 262144; // 0x40000 field public static final int FEATURE_SERIAL_NUMBER = 128; // 0x80 field public static final int FEATURE_SUNLIGHT_ENHANCEMENT = 256; // 0x100 field public static final int FEATURE_TAP_TO_WAKE = 512; // 0x200 @@ -522,6 +527,22 @@ package cyanogenmod.hardware { field public final java.lang.String name; } + public class HSIC implements android.os.Parcelable { + ctor public HSIC(float, float, float, float, float); + method public int describeContents(); + method public java.lang.String flatten(); + method public static cyanogenmod.hardware.HSIC fromFloatArray(float[]); + method public float getContrast(); + method public float getHue(); + method public float getIntensity(); + method public float getSaturation(); + method public float getSaturationThreshold(); + method public float[] toFloatArray(); + method public int[] toRGB(); + method public static cyanogenmod.hardware.HSIC unflattenFrom(java.lang.String) throws java.lang.NumberFormatException; + method public void writeToParcel(android.os.Parcel, int); + } + public abstract interface IThermalListenerCallback implements android.os.IInterface { method public abstract void onThermalChanged(int) throws android.os.RemoteException; } @@ -534,10 +555,11 @@ package cyanogenmod.hardware { } public class LiveDisplayConfig implements android.os.Parcelable { - ctor public LiveDisplayConfig(java.util.BitSet, int, int, int, boolean, boolean, boolean, boolean, android.util.Range<java.lang.Integer>, android.util.Range<java.lang.Integer>); + ctor public LiveDisplayConfig(java.util.BitSet, int, int, int, boolean, boolean, boolean, boolean, android.util.Range<java.lang.Integer>, android.util.Range<java.lang.Integer>, android.util.Range<java.lang.Float>, android.util.Range<java.lang.Float>, android.util.Range<java.lang.Float>, android.util.Range<java.lang.Float>, android.util.Range<java.lang.Float>); method public int describeContents(); method public android.util.Range<java.lang.Integer> getColorBalanceRange(); method public android.util.Range<java.lang.Integer> getColorTemperatureRange(); + method public android.util.Range<java.lang.Float> getContrastRange(); method public boolean getDefaultAutoContrast(); method public boolean getDefaultAutoOutdoorMode(); method public boolean getDefaultCABC(); @@ -545,6 +567,11 @@ package cyanogenmod.hardware { method public int getDefaultDayTemperature(); method public int getDefaultMode(); method public int getDefaultNightTemperature(); + method public android.util.Range<java.lang.Float> getHueRange(); + method public android.util.Range<java.lang.Float> getIntensityRange(); + method public java.util.List<android.util.Range<java.lang.Float>> getPictureAdjustmentRanges(); + method public android.util.Range<java.lang.Float> getSaturationRange(); + method public android.util.Range<java.lang.Float> getSaturationThresholdRange(); method public boolean hasFeature(int); method public boolean hasModeSupport(); method public boolean isAvailable(); @@ -555,9 +582,11 @@ package cyanogenmod.hardware { method public float[] getColorAdjustment(); method public cyanogenmod.hardware.LiveDisplayConfig getConfig(); method public int getDayColorTemperature(); + method public cyanogenmod.hardware.HSIC getDefaultPictureAdjustment(); method public static synchronized cyanogenmod.hardware.LiveDisplayManager getInstance(android.content.Context); method public int getMode(); method public int getNightColorTemperature(); + method public cyanogenmod.hardware.HSIC getPictureAdjustment(); method public boolean isAutoContrastEnabled(); method public boolean isAutomaticOutdoorModeEnabled(); method public boolean isCABCEnabled(); @@ -570,6 +599,11 @@ package cyanogenmod.hardware { method public boolean setDayColorTemperature(int); method public boolean setMode(int); method public boolean setNightColorTemperature(int); + method public boolean setPictureAdjustment(cyanogenmod.hardware.HSIC); + field public static final int ADJUSTMENT_CONTRAST = 3; // 0x3 + field public static final int ADJUSTMENT_HUE = 0; // 0x0 + field public static final int ADJUSTMENT_INTENSITY = 2; // 0x2 + field public static final int ADJUSTMENT_SATURATION = 1; // 0x1 field public static final int FEATURE_AUTO_CONTRAST = 11; // 0xb field public static final int FEATURE_CABC = 10; // 0xa field public static final int FEATURE_COLOR_ADJUSTMENT = 13; // 0xd @@ -577,6 +611,7 @@ package cyanogenmod.hardware { field public static final int FEATURE_COLOR_ENHANCEMENT = 12; // 0xc field public static final int FEATURE_DISPLAY_MODES = 15; // 0xf field public static final int FEATURE_MANAGED_OUTDOOR_MODE = 14; // 0xe + field public static final int FEATURE_PICTURE_ADJUSTMENT = 17; // 0x11 field public static final int MODE_AUTO = 2; // 0x2 field public static final int MODE_DAY = 4; // 0x4 field public static final int MODE_NIGHT = 1; // 0x1 @@ -932,6 +967,7 @@ package cyanogenmod.providers { field public static final java.lang.String DISPLAY_COLOR_ADJUSTMENT = "display_color_adjustment"; field public static final java.lang.String DISPLAY_COLOR_ENHANCE = "display_color_enhance"; field public static final deprecated java.lang.String DISPLAY_LOW_POWER = "display_low_power"; + field public static final java.lang.String DISPLAY_PICTURE_ADJUSTMENT = "display_picture_adjustment"; field public static final java.lang.String DISPLAY_TEMPERATURE_DAY = "display_temperature_day"; field public static final java.lang.String DISPLAY_TEMPERATURE_MODE = "display_temperature_mode"; field public static final java.lang.String DISPLAY_TEMPERATURE_NIGHT = "display_temperature_night"; |