diff options
author | Steve Kondik <steve@cyngn.com> | 2016-04-15 02:38:42 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-04-15 02:38:42 -0700 |
commit | 0ec60c69a090e11355af84c6d99adc3e7e2dcee0 (patch) | |
tree | 6337176bd85846e6b455175f8f33640934edd1e4 /sdk/src | |
parent | 712426f2495cad60273c58cc3ea1427213dc2cbb (diff) | |
download | vendor_cmsdk-0ec60c69a090e11355af84c6d99adc3e7e2dcee0.zip vendor_cmsdk-0ec60c69a090e11355af84c6d99adc3e7e2dcee0.tar.gz vendor_cmsdk-0ec60c69a090e11355af84c6d99adc3e7e2dcee0.tar.bz2 |
livedisplay: Don't explode if no modes are available
* Don't create the mode observer or try to publish tiles if none
of the adaptive modes are supported.
Change-Id: Iee6fe8131b0614e10f35b5a03d65fb44c71c0da9
Diffstat (limited to 'sdk/src')
-rw-r--r-- | sdk/src/java/cyanogenmod/hardware/LiveDisplayConfig.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sdk/src/java/cyanogenmod/hardware/LiveDisplayConfig.java b/sdk/src/java/cyanogenmod/hardware/LiveDisplayConfig.java index 0a569d3..9e499ce 100644 --- a/sdk/src/java/cyanogenmod/hardware/LiveDisplayConfig.java +++ b/sdk/src/java/cyanogenmod/hardware/LiveDisplayConfig.java @@ -39,6 +39,8 @@ import cyanogenmod.os.Concierge.ParcelInfo; public class LiveDisplayConfig implements Parcelable { private final BitSet mCapabilities; + private final BitSet mAllModes = new BitSet(); + private final int mDefaultDayTemperature; private final int mDefaultNightTemperature; private final int mDefaultMode; @@ -54,6 +56,7 @@ public class LiveDisplayConfig implements Parcelable { boolean defaultCABC, boolean defaultColorEnhancement) { super(); mCapabilities = (BitSet) capabilities.clone(); + mAllModes.set(MODE_FIRST, MODE_LAST); mDefaultMode = defaultMode; mDefaultDayTemperature = defaultDayTemperature; mDefaultNightTemperature = defaultNightTemperature; @@ -91,6 +94,7 @@ public class LiveDisplayConfig implements Parcelable { // set temps mCapabilities = BitSet.valueOf(new long[] { capabilities }); + mAllModes.set(MODE_FIRST, MODE_LAST); mDefaultMode = defaultMode; mDefaultDayTemperature = defaultDayTemperature; mDefaultNightTemperature = defaultNightTemperature; @@ -163,6 +167,15 @@ public class LiveDisplayConfig implements Parcelable { } /** + * Checks if LiveDisplay has support for adaptive modes. + * + * @return true if adaptive modes are available + */ + public boolean hasModeSupport() { + return isAvailable() && mCapabilities.intersects(mAllModes); + } + + /** * Gets the default color temperature to use in the daytime. This is typically * set to 6500K, however this may not be entirely accurate. Use this value for * resetting controls to the default. |