sdk: Remove lineagehw compat
Change-Id: I329a74b5e489cc39d183697c25bb9771ae5afd82
This commit is contained in:
@@ -246,7 +246,7 @@ public final class LineageHardwareManager {
|
||||
* @return true if the feature is supported, false otherwise.
|
||||
*/
|
||||
public boolean isSupported(int feature) {
|
||||
return isSupportedHIDL(feature) || isSupportedLegacy(feature);
|
||||
return isSupportedHIDL(feature) || isSupportedHWC2(feature);
|
||||
}
|
||||
|
||||
private boolean isSupportedHIDL(int feature) {
|
||||
@@ -256,7 +256,7 @@ public final class LineageHardwareManager {
|
||||
return mHIDLMap.get(feature) != null;
|
||||
}
|
||||
|
||||
private boolean isSupportedLegacy(int feature) {
|
||||
private boolean isSupportedHWC2(int feature) {
|
||||
try {
|
||||
if (checkService()) {
|
||||
return feature == (sService.getSupportedFeatures() & feature);
|
||||
@@ -432,90 +432,6 @@ public final class LineageHardwareManager {
|
||||
return arr[idx];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
public static final int VIBRATOR_INTENSITY_INDEX = 0;
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
public static final int VIBRATOR_DEFAULT_INDEX = 1;
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
public static final int VIBRATOR_MIN_INDEX = 2;
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
public static final int VIBRATOR_MAX_INDEX = 3;
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
public static final int VIBRATOR_WARNING_INDEX = 4;
|
||||
|
||||
private int[] getVibratorIntensityArray() {
|
||||
try {
|
||||
if (checkService()) {
|
||||
return sService.getVibratorIntensity();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The current vibrator intensity.
|
||||
*/
|
||||
public int getVibratorIntensity() {
|
||||
return getArrayValue(getVibratorIntensityArray(), VIBRATOR_INTENSITY_INDEX, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The default vibrator intensity.
|
||||
*/
|
||||
public int getVibratorDefaultIntensity() {
|
||||
return getArrayValue(getVibratorIntensityArray(), VIBRATOR_DEFAULT_INDEX, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The minimum vibrator intensity.
|
||||
*/
|
||||
public int getVibratorMinIntensity() {
|
||||
return getArrayValue(getVibratorIntensityArray(), VIBRATOR_MIN_INDEX, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The maximum vibrator intensity.
|
||||
*/
|
||||
public int getVibratorMaxIntensity() {
|
||||
return getArrayValue(getVibratorIntensityArray(), VIBRATOR_MAX_INDEX, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The warning threshold vibrator intensity.
|
||||
*/
|
||||
public int getVibratorWarningIntensity() {
|
||||
return getArrayValue(getVibratorIntensityArray(), VIBRATOR_WARNING_INDEX, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current vibrator intensity
|
||||
*
|
||||
* @param intensity the intensity to set, between {@link #getVibratorMinIntensity()} and
|
||||
* {@link #getVibratorMaxIntensity()} inclusive.
|
||||
*
|
||||
* @return true on success, false otherwise.
|
||||
*/
|
||||
public boolean setVibratorIntensity(int intensity) {
|
||||
try {
|
||||
if (checkService()) {
|
||||
return sService.setVibratorIntensity(intensity);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
@@ -620,41 +536,6 @@ public final class LineageHardwareManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if adaptive backlight should be enabled when sunlight enhancement
|
||||
* is enabled.
|
||||
*/
|
||||
public boolean requireAdaptiveBacklightForSunlightEnhancement() {
|
||||
if (isSupportedHIDL(FEATURE_SUNLIGHT_ENHANCEMENT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
if (checkService()) {
|
||||
return sService.requireAdaptiveBacklightForSunlightEnhancement();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this implementation does it's own lux metering
|
||||
*/
|
||||
public boolean isSunlightEnhancementSelfManaged() {
|
||||
if (isSupportedHIDL(FEATURE_SUNLIGHT_ENHANCEMENT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
if (checkService()) {
|
||||
return sService.isSunlightEnhancementSelfManaged();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a list of available display modes on the devices
|
||||
*/
|
||||
@@ -664,8 +545,6 @@ public final class LineageHardwareManager {
|
||||
if (isSupportedHIDL(FEATURE_DISPLAY_MODES)) {
|
||||
IDisplayModes displayModes = (IDisplayModes) mHIDLMap.get(FEATURE_DISPLAY_MODES);
|
||||
modes = HIDLHelper.fromHIDLModes(displayModes.getDisplayModes());
|
||||
} else if (checkService()) {
|
||||
modes= sService.getDisplayModes();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
} finally {
|
||||
@@ -692,8 +571,6 @@ public final class LineageHardwareManager {
|
||||
if (isSupportedHIDL(FEATURE_DISPLAY_MODES)) {
|
||||
IDisplayModes displayModes = (IDisplayModes) mHIDLMap.get(FEATURE_DISPLAY_MODES);
|
||||
mode = HIDLHelper.fromHIDLMode(displayModes.getCurrentDisplayMode());
|
||||
} else if (checkService()) {
|
||||
mode = sService.getCurrentDisplayMode();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
} finally {
|
||||
@@ -710,8 +587,6 @@ public final class LineageHardwareManager {
|
||||
if (isSupportedHIDL(FEATURE_DISPLAY_MODES)) {
|
||||
IDisplayModes displayModes = (IDisplayModes) mHIDLMap.get(FEATURE_DISPLAY_MODES);
|
||||
mode = HIDLHelper.fromHIDLMode(displayModes.getDefaultDisplayMode());
|
||||
} else if (checkService()) {
|
||||
mode = sService.getDefaultDisplayMode();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
} finally {
|
||||
@@ -727,8 +602,6 @@ public final class LineageHardwareManager {
|
||||
if (isSupportedHIDL(FEATURE_DISPLAY_MODES)) {
|
||||
IDisplayModes displayModes = (IDisplayModes) mHIDLMap.get(FEATURE_DISPLAY_MODES);
|
||||
return displayModes.setDisplayMode(mode.id, makeDefault);
|
||||
} else if (checkService()) {
|
||||
return sService.setDisplayMode(mode, makeDefault);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -756,10 +629,6 @@ public final class LineageHardwareManager {
|
||||
if (isSupportedHIDL(FEATURE_COLOR_BALANCE)) {
|
||||
IColorBalance colorBalance = (IColorBalance) mHIDLMap.get(FEATURE_COLOR_BALANCE);
|
||||
return HIDLHelper.fromHIDLRange(colorBalance.getColorBalanceRange());
|
||||
} else if (checkService()) {
|
||||
return new Range<Integer>(
|
||||
sService.getColorBalanceMin(),
|
||||
sService.getColorBalanceMax());
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -774,8 +643,6 @@ public final class LineageHardwareManager {
|
||||
if (isSupportedHIDL(FEATURE_COLOR_BALANCE)) {
|
||||
IColorBalance colorBalance = (IColorBalance) mHIDLMap.get(FEATURE_COLOR_BALANCE);
|
||||
return colorBalance.getColorBalance();
|
||||
} else if (checkService()) {
|
||||
return sService.getColorBalance();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -794,8 +661,6 @@ public final class LineageHardwareManager {
|
||||
if (isSupportedHIDL(FEATURE_COLOR_BALANCE)) {
|
||||
IColorBalance colorBalance = (IColorBalance) mHIDLMap.get(FEATURE_COLOR_BALANCE);
|
||||
return colorBalance.setColorBalance(value);
|
||||
} else if (checkService()) {
|
||||
return sService.setColorBalance(value);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -813,8 +678,6 @@ public final class LineageHardwareManager {
|
||||
IPictureAdjustment pictureAdjustment = (IPictureAdjustment)
|
||||
mHIDLMap.get(FEATURE_PICTURE_ADJUSTMENT);
|
||||
return HIDLHelper.fromHIDLHSIC(pictureAdjustment.getPictureAdjustment());
|
||||
} else if (checkService()) {
|
||||
return sService.getPictureAdjustment();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -832,8 +695,6 @@ public final class LineageHardwareManager {
|
||||
IPictureAdjustment pictureAdjustment = (IPictureAdjustment)
|
||||
mHIDLMap.get(FEATURE_PICTURE_ADJUSTMENT);
|
||||
return HIDLHelper.fromHIDLHSIC(pictureAdjustment.getDefaultPictureAdjustment());
|
||||
} else if (checkService()) {
|
||||
return sService.getDefaultPictureAdjustment();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -852,8 +713,6 @@ public final class LineageHardwareManager {
|
||||
IPictureAdjustment pictureAdjustment = (IPictureAdjustment)
|
||||
mHIDLMap.get(FEATURE_PICTURE_ADJUSTMENT);
|
||||
return pictureAdjustment.setPictureAdjustment(HIDLHelper.toHIDLHSIC(hsic));
|
||||
} else if (checkService()) {
|
||||
return sService.setPictureAdjustment(hsic);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -876,17 +735,6 @@ public final class LineageHardwareManager {
|
||||
HIDLHelper.fromHIDLRange(pictureAdjustment.getIntensityRange()),
|
||||
HIDLHelper.fromHIDLRange(pictureAdjustment.getContrastRange()),
|
||||
HIDLHelper.fromHIDLRange(pictureAdjustment.getSaturationThresholdRange()));
|
||||
} else 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) {
|
||||
}
|
||||
@@ -902,8 +750,6 @@ public final class LineageHardwareManager {
|
||||
ITouchscreenGesture touchscreenGesture = (ITouchscreenGesture)
|
||||
mHIDLMap.get(FEATURE_TOUCHSCREEN_GESTURES);
|
||||
return HIDLHelper.fromHIDLGestures(touchscreenGesture.getSupportedGestures());
|
||||
} else if (checkService()) {
|
||||
return sService.getTouchscreenGestures();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -921,8 +767,6 @@ public final class LineageHardwareManager {
|
||||
mHIDLMap.get(FEATURE_TOUCHSCREEN_GESTURES);
|
||||
return touchscreenGesture.setGestureEnabled(
|
||||
HIDLHelper.toHIDLGesture(gesture), state);
|
||||
} else if (checkService()) {
|
||||
return sService.setTouchscreenGestureEnabled(gesture, state);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user