cmsdk: Add CMHW method to check if SRE is self managed

Change-Id: Ia5f644ce0b964a965afa47ea08016167c8b20620
This commit is contained in:
Steve Kondik 2015-12-08 04:12:45 -08:00 committed by Steve Kondik
parent 8719ebfd17
commit 968127f532
3 changed files with 30 additions and 0 deletions

View File

@ -83,6 +83,7 @@ public class CMHardwareService extends SystemService implements ThermalUpdateCal
public String getSerialNumber();
public boolean requireAdaptiveBacklightForSunlightEnhancement();
public boolean isSunlightEnhancementSelfManaged();
public DisplayMode[] getDisplayModes();
public DisplayMode getCurrentDisplayMode();
@ -296,6 +297,10 @@ public class CMHardwareService extends SystemService implements ThermalUpdateCal
return SunlightEnhancement.isAdaptiveBacklightRequired();
}
public boolean isSunlightEnhancementSelfManaged() {
return SunlightEnhancement.isSelfManaged();
}
public DisplayMode[] getDisplayModes() {
return DisplayModeControl.getAvailableModes();
}
@ -527,6 +532,17 @@ public class CMHardwareService extends SystemService implements ThermalUpdateCal
return mCmHwImpl.requireAdaptiveBacklightForSunlightEnhancement();
}
@Override
public boolean isSunlightEnhancementSelfManaged() {
mContext.enforceCallingOrSelfPermission(
cyanogenmod.platform.Manifest.permission.HARDWARE_ABSTRACTION_ACCESS, null);
if (!isSupported(CMHardwareManager.FEATURE_SUNLIGHT_ENHANCEMENT)) {
Log.e(TAG, "Sunlight enhancement is not supported");
return false;
}
return mCmHwImpl.isSunlightEnhancementSelfManaged();
}
@Override
public DisplayMode[] getDisplayModes() {
mContext.enforceCallingOrSelfPermission(

View File

@ -713,6 +713,19 @@ public final class CMHardwareManager {
return false;
}
/**
* @return true if this implementation does it's own lux metering
*/
public boolean isSunlightEnhancementSelfManaged() {
try {
if (checkService()) {
return sService.isSunlightEnhancementSelfManaged();
}
} catch (RemoteException e) {
}
return false;
}
/**
* @return a list of available display modes on the devices
*/

View File

@ -43,6 +43,7 @@ interface ICMHardwareService {
String getSerialNumber();
boolean requireAdaptiveBacklightForSunlightEnhancement();
boolean isSunlightEnhancementSelfManaged();
DisplayMode[] getDisplayModes();
DisplayMode getCurrentDisplayMode();