lineage-sdk: Add backend for reading enhancement

Change-Id: Ibd1c9e057ddf8e9d21657aef0ebeeaa9a253e92d
This commit is contained in:
Rashed Abdel-Tawab
2018-05-14 13:56:33 -07:00
committed by Joey Rizzoli
parent ff242a26c1
commit 18fd692bbd
7 changed files with 83 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
/**
* Copyright (c) 2015, The CyanogenMod Project
* 2017 The LineageOS Project
* Copyright (c) 2015-2016 The CyanogenMod Project
* 2017-2018 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,4 +65,6 @@ interface ILineageHardwareService {
TouchscreenGesture[] getTouchscreenGestures();
boolean setTouchscreenGestureEnabled(in TouchscreenGesture gesture, boolean state);
boolean setGrayscale(boolean state);
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2016 The CyanogenMod Project
* 2017 The LineageOS Project
* 2017-2018 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -134,6 +134,12 @@ public final class LineageHardwareManager {
@VisibleForTesting
public static final int FEATURE_DISPLAY_MODES = 0x2000;
/**
* Reading mode
*/
@VisibleForTesting
public static final int FEATURE_READING_ENHANCEMENT = 0x4000;
/**
* Color balance
*/
@@ -868,4 +874,19 @@ public final class LineageHardwareManager {
}
return false;
}
/**
* Enables or disables reading mode
*
* @return true if success
*/
public boolean setGrayscale(boolean state) {
try {
if (checkService()) {
return sService.setGrayscale(state);
}
} catch (RemoteException e) {
}
return false;
}
}

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The CyanogenMod Project
* 2018 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -120,6 +121,11 @@ public class LiveDisplayManager {
*/
public static final int FEATURE_PICTURE_ADJUSTMENT = 17;
/**
* System supports grayscale matrix overlay
*/
public static final int FEATURE_READING_ENHANCEMENT = 18;
public static final int ADJUSTMENT_HUE = 0;
public static final int ADJUSTMENT_SATURATION = 1;
public static final int ADJUSTMENT_INTENSITY = 2;

View File

@@ -1449,6 +1449,16 @@ public final class LineageSettings {
public static final Validator DISPLAY_AUTO_OUTDOOR_MODE_VALIDATOR =
sBooleanValidator;
/**
* Reader mode
* 0 = 0ff, 1 = on
*/
public static final String DISPLAY_READING_MODE = "display_reading_mode";
/** @hide */
public static final Validator DISPLAY_READING_MODE_VALIDATOR =
sBooleanValidator;
/**
* Use display power saving features such as CABC or CABL
* 0 = 0ff, 1 = on
@@ -2058,6 +2068,7 @@ public final class LineageSettings {
LineageSettings.System.DISPLAY_TEMPERATURE_NIGHT,
LineageSettings.System.DISPLAY_TEMPERATURE_MODE,
LineageSettings.System.DISPLAY_AUTO_OUTDOOR_MODE,
LineageSettings.System.DISPLAY_READING_MODE,
LineageSettings.System.DISPLAY_CABC,
LineageSettings.System.DISPLAY_COLOR_ENHANCE,
LineageSettings.System.DISPLAY_COLOR_ADJUSTMENT,
@@ -2216,6 +2227,7 @@ public final class LineageSettings {
VALIDATORS.put(DISPLAY_TEMPERATURE_MODE, DISPLAY_TEMPERATURE_MODE_VALIDATOR);
VALIDATORS.put(DISPLAY_AUTO_CONTRAST, DISPLAY_AUTO_CONTRAST_VALIDATOR);
VALIDATORS.put(DISPLAY_AUTO_OUTDOOR_MODE, DISPLAY_AUTO_OUTDOOR_MODE_VALIDATOR);
VALIDATORS.put(DISPLAY_READING_MODE, DISPLAY_READING_MODE_VALIDATOR);
VALIDATORS.put(DISPLAY_CABC, DISPLAY_CABC_VALIDATOR);
VALIDATORS.put(DISPLAY_COLOR_ENHANCE, DISPLAY_COLOR_ENHANCE_VALIDATOR);
VALIDATORS.put(DISPLAY_COLOR_ADJUSTMENT, DISPLAY_COLOR_ADJUSTMENT_VALIDATOR);

View File

@@ -1,5 +1,6 @@
/**
* Copyright (c) 2016, The CyanogenMod Project
* Copyright (c) 2016 The CyanogenMod Project
* 2018 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -69,4 +70,5 @@ public class LineageMetricsLogger extends MetricsLogger {
public static final int WEATHER_SETTINGS = BASE + 42;
public static final int TILE_THEMES = BASE + 43;
public static final int TILE_LOCATION_DETAIL = BASE + 44;
public static final int TILE_READING_MODE = BASE + 45;
}