7 changed files with 38 additions and 71 deletions
@ -1,62 +0,0 @@
@@ -1,62 +0,0 @@
|
||||
/* |
||||
* Copyright (C) 2018 TeamNexus |
||||
* Copyright (C) 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. |
||||
* 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.lineageos.hardware; |
||||
|
||||
import org.lineageos.internal.util.FileUtils; |
||||
|
||||
/** |
||||
* Reader mode |
||||
*/ |
||||
public class ReadingEnhancement { |
||||
|
||||
private static final String ACCESSIBILITY_FILE = |
||||
"/sys/devices/virtual/mdnie/mdnie/accessibility"; |
||||
|
||||
/** |
||||
* Whether device supports Reader Mode |
||||
* |
||||
* @return boolean Supported devices must return always true |
||||
*/ |
||||
public static boolean isSupported() { |
||||
return FileUtils.isFileWritable(ACCESSIBILITY_FILE) && |
||||
FileUtils.isFileReadable(ACCESSIBILITY_FILE); |
||||
} |
||||
|
||||
/** |
||||
* This method return the current activation status of Reader Mode |
||||
* |
||||
* @return boolean Must be false when Reader Mode is not supported or not activated, |
||||
* or the operation failed while reading the status; true in any other case. |
||||
*/ |
||||
public static boolean isEnabled() { |
||||
return FileUtils.readOneLine(ACCESSIBILITY_FILE).equals( |
||||
"Current accessibility : DSI0 : GRAYSCALE "); |
||||
} |
||||
|
||||
/** |
||||
* This method allows to setup Reader Mode |
||||
* |
||||
* @param status The new Reader Mode status |
||||
* @return boolean Must be false if Reader Mode is not supported or the operation |
||||
* failed; true in any other case. |
||||
*/ |
||||
public static boolean setEnabled(boolean status) { |
||||
return FileUtils.writeLine(ACCESSIBILITY_FILE, status ? "4" : "0"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
allow hal_lineage_livedisplay_default { sysfs_graphics sysfs_mdnie }:dir search; |
||||
allow hal_lineage_livedisplay_default { sysfs_graphics sysfs_mdnie }:file rw_file_perms; |
Loading…
Reference in new issue