sdm660-common: Bring back folio daemon and userspace hall switcher
Signed-off-by: pix106 <sbordenave@gmail.com>
This commit is contained in:
parent
77fa9fca99
commit
7f5c98e112
24 changed files with 313 additions and 4 deletions
|
@ -91,4 +91,6 @@
|
||||||
<string name="edit_hint" formatted="false">Wert zwischen %1d und %2d</string>
|
<string name="edit_hint" formatted="false">Wert zwischen %1d und %2d</string>
|
||||||
<string name="advanced_doze_summary">Inaktivitätsdisplay</string>
|
<string name="advanced_doze_summary">Inaktivitätsdisplay</string>
|
||||||
<string name="grayscale">Graustufen-Modus</string>
|
<string name="grayscale">Graustufen-Modus</string>
|
||||||
|
<string name="hall_title">Aktiviere Aufwecken mit Flip Cover </string>
|
||||||
|
<string name="hall_wakeup_summary">Schalte das Gerät AN und AUS mit einem magnetischen Flip Cover</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
<string name="preset_extreme_amoled">Amoled Extremo</string>
|
<string name="preset_extreme_amoled">Amoled Extremo</string>
|
||||||
<string name="preset_warm_amoled">Amoled caliente</string>
|
<string name="preset_warm_amoled">Amoled caliente</string>
|
||||||
<string name="preset_hybrid_mamba">Mamba híbrido</string>
|
<string name="preset_hybrid_mamba">Mamba híbrido</string>
|
||||||
|
|
||||||
|
<string name="hall_wakeup_title">Despertar con funda flip</string>
|
||||||
|
<string name="hall_title">Activar levantamiento con funda flip</string>
|
||||||
|
<string name="hall_wakeup_summary">Despertar dispositivo con una funda flip magnética</string>
|
||||||
|
|
||||||
<!-- CustomSeekBarPreference -->
|
<!-- CustomSeekBarPreference -->
|
||||||
<string name="default_value">Valor por defecto</string>
|
<string name="default_value">Valor por defecto</string>
|
||||||
|
|
|
@ -112,6 +112,9 @@
|
||||||
<string name="preset_warm_amoled">Amoled hangat</string>
|
<string name="preset_warm_amoled">Amoled hangat</string>
|
||||||
<string name="preset_hybrid_mamba">Hibrid</string>
|
<string name="preset_hybrid_mamba">Hibrid</string>
|
||||||
|
|
||||||
|
<string name="hall_wakeup_title">Flip cover nyala</string>
|
||||||
|
<string name="hall_title">Aktifkan Flip Cover nyala</string>
|
||||||
|
<string name="hall_wakeup_summary">Nyalakan perangkat saat flip cover magnetik dibuka</string>
|
||||||
<!-- menu -->
|
<!-- menu -->
|
||||||
<string name="kcal_presets">@string/presets_dialog_title</string>
|
<string name="kcal_presets">@string/presets_dialog_title</string>
|
||||||
<string name="kcal_reset">Reset</string>
|
<string name="kcal_reset">Reset</string>
|
||||||
|
|
|
@ -106,6 +106,8 @@
|
||||||
<string name="preset_warm_amoled">暖色 AMOLED</string>
|
<string name="preset_warm_amoled">暖色 AMOLED</string>
|
||||||
<string name="preset_hybrid_mamba">Hybrid Mamba</string>
|
<string name="preset_hybrid_mamba">Hybrid Mamba</string>
|
||||||
|
|
||||||
|
<!-- usb fastcharge -->
|
||||||
|
|
||||||
<!-- menu -->
|
<!-- menu -->
|
||||||
<string name="kcal_presets" translatable="false">@string/presets_dialog_title</string>
|
<string name="kcal_presets" translatable="false">@string/presets_dialog_title</string>
|
||||||
<string name="kcal_reset">リセット</string>
|
<string name="kcal_reset">リセット</string>
|
||||||
|
@ -114,5 +116,9 @@
|
||||||
<string name="edit_value">新しい値を選択して下さい</string>
|
<string name="edit_value">新しい値を選択して下さい</string>
|
||||||
<string name="default_value">既定値</string>
|
<string name="default_value">既定値</string>
|
||||||
<string name="edit_hint" formatted="false">値は %1$d と %2$d の間です</string>
|
<string name="edit_hint" formatted="false">値は %1$d と %2$d の間です</string>
|
||||||
|
|
||||||
|
<!-- Flip cover wake -->
|
||||||
|
<string name="hall_wakeup_title">フリップカバーの復帰</string>
|
||||||
|
<string name="hall_title">フリップカバーの復帰の有効化</string>
|
||||||
|
<string name="hall_wakeup_summary">マグネットフリップカバーでスリープ解除する</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -114,6 +114,9 @@
|
||||||
<string name="preset_warm_amoled">Amoled Quente</string>
|
<string name="preset_warm_amoled">Amoled Quente</string>
|
||||||
<string name="preset_hybrid_mamba">Mamba Híbrida</string>
|
<string name="preset_hybrid_mamba">Mamba Híbrida</string>
|
||||||
|
|
||||||
|
<string name="hall_wakeup_title">Flip Cover</string>
|
||||||
|
<string name="hall_title">Ativar a tela com Flip Cover</string>
|
||||||
|
<string name="hall_wakeup_summary">Ativa a tela ao usar uma Flip Cover magnética</string>
|
||||||
<!-- menu -->
|
<!-- menu -->
|
||||||
<string name="kcal_presets">@string/presets_dialog_title</string>
|
<string name="kcal_presets">@string/presets_dialog_title</string>
|
||||||
<string name="kcal_reset">Redefinir</string>
|
<string name="kcal_reset">Redefinir</string>
|
||||||
|
|
|
@ -114,6 +114,9 @@
|
||||||
<string name="preset_warm_amoled">Теплый Amoled</string>
|
<string name="preset_warm_amoled">Теплый Amoled</string>
|
||||||
<string name="preset_hybrid_mamba">Гибридная Мамба</string>
|
<string name="preset_hybrid_mamba">Гибридная Мамба</string>
|
||||||
|
|
||||||
|
<string name="hall_wakeup_title">Пробуждение умным чехлом</string>
|
||||||
|
<string name="hall_title">Включить пробуждение откидной крышкой</string>
|
||||||
|
<string name="hall_wakeup_summary">Пробуждение устройства через магнитную откидную крышку</string>
|
||||||
<!-- menu -->
|
<!-- menu -->
|
||||||
<string name="kcal_presets">@string/presets_dialog_title</string>
|
<string name="kcal_presets">@string/presets_dialog_title</string>
|
||||||
<string name="kcal_reset">Сбросить</string>
|
<string name="kcal_reset">Сбросить</string>
|
||||||
|
|
|
@ -112,6 +112,9 @@
|
||||||
<string name="preset_warm_amoled">Teplý - Amoled</string>
|
<string name="preset_warm_amoled">Teplý - Amoled</string>
|
||||||
<string name="preset_hybrid_mamba">Hybrid Mamba</string>
|
<string name="preset_hybrid_mamba">Hybrid Mamba</string>
|
||||||
|
|
||||||
|
<string name="hall_wakeup_title">Zobudenie preklopením krytu</string>
|
||||||
|
<string name="hall_title">Povoliť zobudenie preklopením krytu</string>
|
||||||
|
<string name="hall_wakeup_summary">Zobudenia zariadenia magnetickým krytom</string>
|
||||||
<!-- menu -->
|
<!-- menu -->
|
||||||
<string name="kcal_presets">@string/presets_dialog_title</string>
|
<string name="kcal_presets">@string/presets_dialog_title</string>
|
||||||
<string name="kcal_reset">Resetovať</string>
|
<string name="kcal_reset">Resetovať</string>
|
||||||
|
|
|
@ -69,6 +69,9 @@
|
||||||
<string name="preset_warm_amoled">Warm Amoled</string>
|
<string name="preset_warm_amoled">Warm Amoled</string>
|
||||||
<string name="preset_hybrid_mamba">Hybrid Mamba</string>
|
<string name="preset_hybrid_mamba">Hybrid Mamba</string>
|
||||||
|
|
||||||
|
<string name="hall_wakeup_title">Flip Cover Wakeup</string>
|
||||||
|
<string name="hall_title">Enable Flip Cover Wakeup</string>
|
||||||
|
<string name="hall_wakeup_summary">Wakeup device via magnetic Flip Cover</string>
|
||||||
<!-- menu -->
|
<!-- menu -->
|
||||||
<string name="kcal_presets">@string/presets_dialog_title</string>
|
<string name="kcal_presets">@string/presets_dialog_title</string>
|
||||||
<string name="kcal_reset">Reset</string>
|
<string name="kcal_reset">Reset</string>
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
-->
|
-->
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="vibration"
|
android:key="vibration"
|
||||||
android:title="@string/vibration_title">
|
android:title="@string/vibration_title">
|
||||||
|
@ -149,4 +148,15 @@
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="hall_wakeup"
|
||||||
|
android:title="@string/hall_wakeup_title">
|
||||||
|
|
||||||
|
<org.lineageos.settings.device.preferences.SecureSettingSwitchPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="hall"
|
||||||
|
android:summary="@string/hall_wakeup_summary"
|
||||||
|
android:title="@string/hall_title"
|
||||||
|
android:icon="@drawable/ic_flip" />
|
||||||
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -77,6 +77,10 @@ public class BootReceiver extends BroadcastReceiver implements Utils {
|
||||||
// Vibration Strength
|
// Vibration Strength
|
||||||
FileUtils.setValue(DeviceSettings.VIBRATION_STRENGTH_PATH, Settings.Secure.getInt(
|
FileUtils.setValue(DeviceSettings.VIBRATION_STRENGTH_PATH, Settings.Secure.getInt(
|
||||||
context.getContentResolver(), DeviceSettings.PREF_VIBRATION_STRENGTH, 80) / 100.0 * (DeviceSettings.MAX_VIBRATION - DeviceSettings.MIN_VIBRATION) + DeviceSettings.MIN_VIBRATION);
|
context.getContentResolver(), DeviceSettings.PREF_VIBRATION_STRENGTH, 80) / 100.0 * (DeviceSettings.MAX_VIBRATION - DeviceSettings.MIN_VIBRATION) + DeviceSettings.MIN_VIBRATION);
|
||||||
|
FileUtils.setValue(DeviceSettings.HALL_WAKEUP_PATH, Settings.Secure.getInt(
|
||||||
|
context.getContentResolver(), DeviceSettings.PREF_HALL_WAKEUP, 1) == 1 ? "Y" : "N");
|
||||||
|
FileUtils.setProp(DeviceSettings.HALL_WAKEUP_PROP, Settings.Secure.getInt(
|
||||||
|
context.getContentResolver(), DeviceSettings.PREF_HALL_WAKEUP, 1) == 1);
|
||||||
|
|
||||||
// Dirac
|
// Dirac
|
||||||
context.startService(new Intent(context, DiracService.class));
|
context.startService(new Intent(context, DiracService.class));
|
||||||
|
|
|
@ -69,6 +69,11 @@ public class DeviceSettings extends PreferenceFragment implements
|
||||||
private static final String PREF_DEVICE_DOZE = "device_doze";
|
private static final String PREF_DEVICE_DOZE = "device_doze";
|
||||||
private static final String PREF_DEVICE_KCAL = "device_kcal";
|
private static final String PREF_DEVICE_KCAL = "device_kcal";
|
||||||
|
|
||||||
|
private static final String CATEGORY_HALL_WAKEUP = "hall_wakeup";
|
||||||
|
public static final String PREF_HALL_WAKEUP = "hall";
|
||||||
|
public static final String HALL_WAKEUP_PATH = "/sys/module/hall/parameters/hall_toggle";
|
||||||
|
public static final String HALL_WAKEUP_PROP = "persist.service.folio_daemon";
|
||||||
|
|
||||||
private static final String DEVICE_DOZE_PACKAGE_NAME = "com.advanced.settings.doze";
|
private static final String DEVICE_DOZE_PACKAGE_NAME = "com.advanced.settings.doze";
|
||||||
|
|
||||||
private static final String DEVICE_JASON_PACKAGE_NAME = "org.lineageos.settings.devicex";
|
private static final String DEVICE_JASON_PACKAGE_NAME = "org.lineageos.settings.devicex";
|
||||||
|
@ -166,6 +171,13 @@ public class DeviceSettings extends PreferenceFragment implements
|
||||||
mPreset = (SecureSettingListPreference) findPreference(PREF_PRESET);
|
mPreset = (SecureSettingListPreference) findPreference(PREF_PRESET);
|
||||||
mPreset.setOnPreferenceChangeListener(this);
|
mPreset.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
|
if (FileUtils.fileWritable(HALL_WAKEUP_PATH)) {
|
||||||
|
SecureSettingSwitchPreference hall = (SecureSettingSwitchPreference) findPreference(PREF_HALL_WAKEUP);
|
||||||
|
hall.setChecked(FileUtils.getValue(HALL_WAKEUP_PATH).equals("Y"));
|
||||||
|
hall.setOnPreferenceChangeListener(this);
|
||||||
|
} else {
|
||||||
|
getPreferenceScreen().removePreference(findPreference(CATEGORY_HALL_WAKEUP));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -220,6 +232,11 @@ public class DeviceSettings extends PreferenceFragment implements
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PREF_HALL_WAKEUP:
|
||||||
|
FileUtils.setValue(HALL_WAKEUP_PATH, (boolean) value ? "Y" : "N");
|
||||||
|
FileUtils.setProp(HALL_WAKEUP_PROP, (boolean) value);
|
||||||
|
break;
|
||||||
|
|
||||||
case PREF_KEY_FPS_INFO:
|
case PREF_KEY_FPS_INFO:
|
||||||
boolean enabled = (boolean) value;
|
boolean enabled = (boolean) value;
|
||||||
Intent fpsinfo = new Intent(this.getContext(), FPSInfoService.class);
|
Intent fpsinfo = new Intent(this.getContext(), FPSInfoService.class);
|
||||||
|
|
21
folio_daemon/Android.bp
Executable file
21
folio_daemon/Android.bp
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
cc_binary {
|
||||||
|
name: "folio_daemon",
|
||||||
|
|
||||||
|
shared_libs: [
|
||||||
|
"libandroid",
|
||||||
|
"libcutils",
|
||||||
|
"liblog",
|
||||||
|
],
|
||||||
|
|
||||||
|
srcs: ["main.cpp"],
|
||||||
|
|
||||||
|
cflags: [
|
||||||
|
"-DLOG_TAG=\"folio_daemon\"",
|
||||||
|
"-DLOG_NDEBUG=0",
|
||||||
|
"-Wall",
|
||||||
|
"-Werror",
|
||||||
|
],
|
||||||
|
|
||||||
|
owner: "google",
|
||||||
|
|
||||||
|
}
|
182
folio_daemon/main.cpp
Normal file
182
folio_daemon/main.cpp
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2017 The Android Open Source 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <linux/input.h>
|
||||||
|
#include <linux/uinput.h>
|
||||||
|
#include <android/looper.h>
|
||||||
|
#include <android/sensor.h>
|
||||||
|
#include <cutils/log.h>
|
||||||
|
|
||||||
|
// Hall-effect sensor type
|
||||||
|
#define SENSOR_TYPE 33171016
|
||||||
|
|
||||||
|
#define RETRY_LIMIT 120
|
||||||
|
#define RETRY_PERIOD 30 // 30 seconds
|
||||||
|
#define WARN_PERIOD (time_t)300 // 5 minutes
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This simple daemon listens for events from the Hall-effect sensor and writes
|
||||||
|
* the appropriate SW_LID event to a uinput node. This allows the screen to be
|
||||||
|
* locked with a magnetic folio case.
|
||||||
|
*/
|
||||||
|
int main(void) {
|
||||||
|
int uinputFd;
|
||||||
|
int err;
|
||||||
|
struct uinput_user_dev uidev;
|
||||||
|
ASensorManager *sensorManager = nullptr;
|
||||||
|
ASensorRef hallSensor;
|
||||||
|
ALooper *looper;
|
||||||
|
ASensorEventQueue *eventQueue = nullptr;
|
||||||
|
time_t lastWarn = 0;
|
||||||
|
int attemptCount = 0;
|
||||||
|
|
||||||
|
ALOGI("Started");
|
||||||
|
|
||||||
|
uinputFd = TEMP_FAILURE_RETRY(open("/dev/uinput", O_WRONLY | O_NONBLOCK));
|
||||||
|
if (uinputFd < 0) {
|
||||||
|
ALOGE("Unable to open uinput node: %s", strerror(errno));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = TEMP_FAILURE_RETRY(ioctl(uinputFd, UI_SET_EVBIT, EV_SW))
|
||||||
|
| TEMP_FAILURE_RETRY(ioctl(uinputFd, UI_SET_EVBIT, EV_SYN))
|
||||||
|
| TEMP_FAILURE_RETRY(ioctl(uinputFd, UI_SET_SWBIT, SW_LID));
|
||||||
|
if (err != 0) {
|
||||||
|
ALOGE("Unable to enable SW_LID events: %s", strerror(errno));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&uidev, 0, sizeof (uidev));
|
||||||
|
snprintf(uidev.name, UINPUT_MAX_NAME_SIZE, "uinput-folio");
|
||||||
|
uidev.id.bustype = BUS_VIRTUAL;
|
||||||
|
uidev.id.vendor = 0;
|
||||||
|
uidev.id.product = 0;
|
||||||
|
uidev.id.version = 0;
|
||||||
|
|
||||||
|
err = TEMP_FAILURE_RETRY(write(uinputFd, &uidev, sizeof (uidev)));
|
||||||
|
if (err < 0) {
|
||||||
|
ALOGE("Write user device to uinput node failed: %s", strerror(errno));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = TEMP_FAILURE_RETRY(ioctl(uinputFd, UI_DEV_CREATE));
|
||||||
|
if (err < 0) {
|
||||||
|
ALOGE("Unable to create uinput device: %s", strerror(errno));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALOGI("Successfully registered uinput-folio for SW_LID events");
|
||||||
|
|
||||||
|
// Get Hall-effect sensor events from the NDK
|
||||||
|
sensorManager = ASensorManager_getInstanceForPackage(nullptr);
|
||||||
|
/*
|
||||||
|
* As long as we are unable to get the sensor handle, periodically retry
|
||||||
|
* and emit an error message at a low frequency to prevent high CPU usage
|
||||||
|
* and log spam. If we simply exited with an error here, we would be
|
||||||
|
* immediately restarted and fail in the same way indefinitely.
|
||||||
|
*/
|
||||||
|
while (true) {
|
||||||
|
time_t now = time(NULL);
|
||||||
|
hallSensor = ASensorManager_getDefaultSensor(sensorManager,
|
||||||
|
SENSOR_TYPE);
|
||||||
|
if (hallSensor != nullptr) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (++attemptCount >= RETRY_LIMIT) {
|
||||||
|
ALOGE("Retries exhausted; exiting");
|
||||||
|
goto out;
|
||||||
|
} else if (now > lastWarn + WARN_PERIOD) {
|
||||||
|
ALOGE("Unable to get Hall-effect sensor");
|
||||||
|
lastWarn = now;
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(RETRY_PERIOD);
|
||||||
|
}
|
||||||
|
|
||||||
|
looper = ALooper_forThread();
|
||||||
|
if (looper == nullptr) {
|
||||||
|
looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS);
|
||||||
|
}
|
||||||
|
|
||||||
|
eventQueue = ASensorManager_createEventQueue(sensorManager, looper, 0, NULL,
|
||||||
|
NULL);
|
||||||
|
err = ASensorEventQueue_registerSensor(eventQueue, hallSensor,
|
||||||
|
ASensor_getMinDelay(hallSensor),
|
||||||
|
10000);
|
||||||
|
if (err < 0) {
|
||||||
|
ALOGE("Unable to register for Hall-effect sensor events");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALOGI("Starting polling loop");
|
||||||
|
|
||||||
|
// Polling loop
|
||||||
|
while (ALooper_pollAll(-1, NULL, NULL, NULL) == 0) {
|
||||||
|
int eventCount = 0;
|
||||||
|
ASensorEvent sensorEvent;
|
||||||
|
while (ASensorEventQueue_getEvents(eventQueue, &sensorEvent, 1) > 0) {
|
||||||
|
// 1 means closed; 0 means open
|
||||||
|
int isClosed = sensorEvent.data[0] > 0.0f ? 1 : 0;
|
||||||
|
struct input_event event;
|
||||||
|
event.type = EV_SW;
|
||||||
|
event.code = SW_LID;
|
||||||
|
event.value = isClosed;
|
||||||
|
err = TEMP_FAILURE_RETRY(write(uinputFd, &event, sizeof (event)));
|
||||||
|
if (err < 0) {
|
||||||
|
ALOGE("Write EV_SW to uinput node failed: %s", strerror(errno));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force a flush with an EV_SYN
|
||||||
|
event.type = EV_SYN;
|
||||||
|
event.code = SYN_REPORT;
|
||||||
|
event.value = 0;
|
||||||
|
err = TEMP_FAILURE_RETRY(write(uinputFd, &event, sizeof (event)));
|
||||||
|
if (err < 0) {
|
||||||
|
ALOGE("Write EV_SYN to uinput node failed: %s",
|
||||||
|
strerror(errno));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALOGI("Sent lid %s event", isClosed ? "closed" : "open");
|
||||||
|
eventCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eventCount == 0) {
|
||||||
|
ALOGE("Poll returned with zero events: %s", strerror(errno));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
// Clean up
|
||||||
|
if (sensorManager != nullptr && eventQueue != nullptr) {
|
||||||
|
ASensorManager_destroyEventQueue(sensorManager, eventQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uinputFd >= 0) {
|
||||||
|
close(uinputFd);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The loop can only be exited via failure or signal
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -465,6 +465,18 @@ service dcvs-sh /vendor/bin/init.qti.dcvs.sh
|
||||||
on property:vendor.dcvs.prop=1
|
on property:vendor.dcvs.prop=1
|
||||||
start dcvs-sh
|
start dcvs-sh
|
||||||
|
|
||||||
|
service folio_daemon /system/bin/folio_daemon
|
||||||
|
class late_start
|
||||||
|
user system
|
||||||
|
group system uhid
|
||||||
|
disabled
|
||||||
|
|
||||||
|
on property:persist.service.folio_daemon=0
|
||||||
|
stop folio_daemon
|
||||||
|
|
||||||
|
on property:persist.service.folio_daemon=1
|
||||||
|
start folio_daemon
|
||||||
|
|
||||||
service ppd /system/vendor/bin/mm-pp-dpps
|
service ppd /system/vendor/bin/mm-pp-dpps
|
||||||
class late_start
|
class late_start
|
||||||
user system
|
user system
|
||||||
|
|
|
@ -15,9 +15,11 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
on boot
|
on boot
|
||||||
# Haptic strength
|
# XiaomiParts
|
||||||
chown system system /sys/devices/virtual/timed_output/vibrator/vtg_level
|
chown system system /sys/devices/virtual/timed_output/vibrator/vtg_level
|
||||||
chmod 0660 /sys/devices/virtual/timed_output/vibrator/vtg_level
|
chmod 0660 /sys/devices/virtual/timed_output/vibrator/vtg_level
|
||||||
|
chown system system /sys/module/hall/parameters/hall_toggle
|
||||||
|
chmod 0660 /sys/module/hall/parameters/hall_toggle
|
||||||
|
|
||||||
# FPS
|
# FPS
|
||||||
chown system system /sys/devices/virtual/graphics/fb0/measured_fps
|
chown system system /sys/devices/virtual/graphics/fb0/measured_fps
|
||||||
|
|
|
@ -203,6 +203,10 @@ PRODUCT_PACKAGES += \
|
||||||
android.hardware.drm@1.4-service.clearkey \
|
android.hardware.drm@1.4-service.clearkey \
|
||||||
android.hardware.drm@1.4.vendor
|
android.hardware.drm@1.4.vendor
|
||||||
|
|
||||||
|
# Folio
|
||||||
|
PRODUCT_PACKAGES += \
|
||||||
|
folio_daemon
|
||||||
|
|
||||||
# Freeform Multiwindow
|
# Freeform Multiwindow
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
frameworks/native/data/etc/android.software.freeform_window_management.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.freeform_window_management.xml
|
frameworks/native/data/etc/android.software.freeform_window_management.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.freeform_window_management.xml
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# Executables
|
# Executables
|
||||||
/system/bin/chargeonlymode u:object_r:charger_exec:s0
|
/system/bin/chargeonlymode u:object_r:charger_exec:s0
|
||||||
|
/system/bin/folio_daemon u:object_r:folio_daemon_exec:s0
|
||||||
|
|
15
sepolicy/private/folio_daemon.te
Normal file
15
sepolicy/private/folio_daemon.te
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
type folio_daemon, domain, coredomain;
|
||||||
|
type folio_daemon_exec, system_file_type, exec_type, file_type;
|
||||||
|
|
||||||
|
init_daemon_domain(folio_daemon)
|
||||||
|
|
||||||
|
allow folio_daemon binder_device:chr_file rw_file_perms;
|
||||||
|
allow folio_daemon uhid_device:chr_file rw_file_perms;
|
||||||
|
|
||||||
|
allow folio_daemon system_server:unix_stream_socket rw_socket_perms_no_ioctl;
|
||||||
|
|
||||||
|
binder_use(folio_daemon)
|
||||||
|
binder_call(folio_daemon, system_server)
|
||||||
|
|
||||||
|
allow folio_daemon sensorservice_service:service_manager find;
|
||||||
|
allow folio_daemon permission_service:service_manager find;
|
|
@ -1,3 +1,4 @@
|
||||||
|
binder_call(system_server, folio_daemon)
|
||||||
|
|
||||||
# Allow system_server to set persist_camera_prop
|
# Allow system_server to set persist_camera_prop
|
||||||
get_prop(system_server, vendor_persist_camera_prop)
|
get_prop(system_server, vendor_persist_camera_prop)
|
||||||
|
|
3
sepolicy/vendor/file.te
vendored
3
sepolicy/vendor/file.te
vendored
|
@ -14,6 +14,9 @@ type sysfs_earpiecegain, sysfs_type, fs_type;
|
||||||
# HVDCP
|
# HVDCP
|
||||||
type vendor_sysfs_hvdcp, fs_type, sysfs_type;
|
type vendor_sysfs_hvdcp, fs_type, sysfs_type;
|
||||||
|
|
||||||
|
# Hall Switch
|
||||||
|
type hall_dev, sysfs_type, fs_type;
|
||||||
|
|
||||||
# Kcal
|
# Kcal
|
||||||
type kcal_dev, sysfs_type, fs_type;
|
type kcal_dev, sysfs_type, fs_type;
|
||||||
|
|
||||||
|
|
3
sepolicy/vendor/file_contexts
vendored
3
sepolicy/vendor/file_contexts
vendored
|
@ -29,6 +29,9 @@
|
||||||
/bt_firmware(/.*)? u:object_r:bt_firmware_file:s0
|
/bt_firmware(/.*)? u:object_r:bt_firmware_file:s0
|
||||||
/persist(/.*)? u:object_r:persist_file:s0
|
/persist(/.*)? u:object_r:persist_file:s0
|
||||||
|
|
||||||
|
# Hall Switch
|
||||||
|
/sys/module/hall/parameters(/.*)? u:object_r:hall_dev:s0
|
||||||
|
|
||||||
# Hexagon DSP-side executable needed for Halide operation
|
# Hexagon DSP-side executable needed for Halide operation
|
||||||
# This is labeled as public_adsprpcd_file as it needs to be read by apps
|
# This is labeled as public_adsprpcd_file as it needs to be read by apps
|
||||||
# (e.g. Google Camera App)
|
# (e.g. Google Camera App)
|
||||||
|
|
3
sepolicy/vendor/property_contexts
vendored
3
sepolicy/vendor/property_contexts
vendored
|
@ -40,6 +40,9 @@ ro.boot.fp. u:object_r:hal_fingerprint_prop:s0
|
||||||
ro.boot.fpsensor u:object_r:hal_fingerprint_prop:s0
|
ro.boot.fpsensor u:object_r:hal_fingerprint_prop:s0
|
||||||
sys.fp. u:object_r:hal_fingerprint_prop:s0
|
sys.fp. u:object_r:hal_fingerprint_prop:s0
|
||||||
|
|
||||||
|
# Hall wakeup
|
||||||
|
persist.service.folio_daemon u:object_r:system_prop:s0
|
||||||
|
|
||||||
# Media
|
# Media
|
||||||
gpu.stats.debug.level u:object_r:vendor_default_prop:s0
|
gpu.stats.debug.level u:object_r:vendor_default_prop:s0
|
||||||
|
|
||||||
|
|
2
sepolicy/vendor/system_app.te
vendored
2
sepolicy/vendor/system_app.te
vendored
|
@ -1,4 +1,6 @@
|
||||||
allow system_app blkio_dev:dir search;
|
allow system_app blkio_dev:dir search;
|
||||||
|
allow system_app hall_dev:file rw_file_perms;
|
||||||
|
allow system_app hall_dev:dir search;
|
||||||
allow system_app kcal_dev:dir search;
|
allow system_app kcal_dev:dir search;
|
||||||
allow system_app kcal_dev:file rw_file_perms;
|
allow system_app kcal_dev:file rw_file_perms;
|
||||||
allow system_app proc_vmallocinfo:file read;
|
allow system_app proc_vmallocinfo:file read;
|
||||||
|
|
3
sepolicy/vendor/ueventd.te
vendored
3
sepolicy/vendor/ueventd.te
vendored
|
@ -1 +1,4 @@
|
||||||
|
allow ueventd hall_dev:dir r_dir_perms;
|
||||||
|
allow ueventd hall_dev:file rw_file_perms;
|
||||||
|
allow ueventd hall_dev:lnk_file r_file_perms;
|
||||||
allow ueventd metadata_file:dir search;
|
allow ueventd metadata_file:dir search;
|
||||||
|
|
Loading…
Reference in a new issue