sdm660-common: DeviceSettings: Drop userspace hall switcher
* The sensor works as it is, hence not needed anymore
This commit is contained in:
parent
0103df44b3
commit
2135c18643
23 changed files with 3 additions and 302 deletions
|
@ -60,6 +60,4 @@
|
||||||
<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>
|
||||||
|
|
|
@ -78,10 +78,6 @@
|
||||||
<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>
|
||||||
<string name="edit_hint" formatted="false">Valor entre %1$d y %2$d</string>
|
<string name="edit_hint" formatted="false">Valor entre %1$d y %2$d</string>
|
||||||
|
|
|
@ -82,9 +82,6 @@
|
||||||
<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>
|
||||||
|
|
|
@ -74,8 +74,6 @@
|
||||||
<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>
|
||||||
|
@ -85,8 +83,4 @@
|
||||||
<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>
|
||||||
|
|
|
@ -82,9 +82,6 @@
|
||||||
<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>
|
||||||
|
|
|
@ -82,9 +82,6 @@
|
||||||
<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>
|
||||||
|
|
|
@ -82,9 +82,6 @@
|
||||||
<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>
|
||||||
|
|
|
@ -82,9 +82,6 @@
|
||||||
<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,6 +15,7 @@
|
||||||
-->
|
-->
|
||||||
<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">
|
||||||
|
@ -123,15 +124,4 @@
|
||||||
android:icon="@drawable/ic_thermal" />
|
android:icon="@drawable/ic_thermal" />
|
||||||
</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>
|
||||||
|
|
|
@ -71,10 +71,6 @@ public class BootReceiver extends BroadcastReceiver implements Utils {
|
||||||
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.THERMAL_PATH, Settings.Secure.getString(
|
FileUtils.setValue(DeviceSettings.THERMAL_PATH, Settings.Secure.getString(
|
||||||
context.getContentResolver(), DeviceSettings.PREF_THERMAL));
|
context.getContentResolver(), DeviceSettings.PREF_THERMAL));
|
||||||
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);
|
|
||||||
|
|
||||||
boolean enabled = Settings.Secure.getInt(context.getContentResolver(), DeviceSettings.PREF_KEY_FPS_INFO, 0) == 1;
|
boolean enabled = Settings.Secure.getInt(context.getContentResolver(), DeviceSettings.PREF_KEY_FPS_INFO, 0) == 1;
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
|
|
|
@ -65,11 +65,6 @@ public class DeviceSettings extends PreferenceFragment implements
|
||||||
public static final String PREF_THERMAL = "thermal";
|
public static final String PREF_THERMAL = "thermal";
|
||||||
public static final String THERMAL_PATH = "/sys/devices/virtual/thermal/thermal_message/sconfig";
|
public static final String THERMAL_PATH = "/sys/devices/virtual/thermal/thermal_message/sconfig";
|
||||||
|
|
||||||
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";
|
||||||
|
@ -127,13 +122,6 @@ public class DeviceSettings extends PreferenceFragment implements
|
||||||
mTHERMAL.setSummary(mTHERMAL.getEntry());
|
mTHERMAL.setSummary(mTHERMAL.getEntry());
|
||||||
mTHERMAL.setOnPreferenceChangeListener(this);
|
mTHERMAL.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
|
||||||
|
@ -163,11 +151,6 @@ public class DeviceSettings extends PreferenceFragment implements
|
||||||
FileUtils.setValue(THERMAL_PATH, (String) value);
|
FileUtils.setValue(THERMAL_PATH, (String) value);
|
||||||
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);
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
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",
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,182 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
|
@ -15,11 +15,9 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
on boot
|
on boot
|
||||||
# XiaomiParts
|
# Haptic strength
|
||||||
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
|
||||||
|
|
|
@ -228,10 +228,6 @@ PRODUCT_PACKAGES += \
|
||||||
android.hardware.drm@1.0-service \
|
android.hardware.drm@1.0-service \
|
||||||
android.hardware.drm@1.3-service.clearkey
|
android.hardware.drm@1.3-service.clearkey
|
||||||
|
|
||||||
# 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,5 +1,4 @@
|
||||||
# Executables
|
# Executables
|
||||||
/system/bin/folio_daemon u:object_r:folio_daemon_exec:s0
|
|
||||||
/system/bin/chargeonlymode u:object_r:charger_exec:s0
|
/system/bin/chargeonlymode u:object_r:charger_exec:s0
|
||||||
|
|
||||||
# OTA packages
|
# OTA packages
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
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,4 +1,2 @@
|
||||||
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
|
@ -10,9 +10,6 @@ type fingerprintd_device, file_type, dev_type;
|
||||||
type persist_fingerprint_file, file_type;
|
type persist_fingerprint_file, file_type;
|
||||||
type sysfs_fingerprint, sysfs_type, fs_type;
|
type sysfs_fingerprint, sysfs_type, fs_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
|
@ -27,9 +27,6 @@
|
||||||
/data/vendor/goodix(/.*)? u:object_r:fingerprint_vendor_data_file:s0
|
/data/vendor/goodix(/.*)? u:object_r:fingerprint_vendor_data_file:s0
|
||||||
/dev/goodix_fp u:object_r:fingerprint_device:s0
|
/dev/goodix_fp u:object_r:fingerprint_device:s0
|
||||||
|
|
||||||
# Hall Switch
|
|
||||||
/sys/module/hall/parameters(/.*)? u:object_r:hall_dev:s0
|
|
||||||
|
|
||||||
# HVDCP
|
# HVDCP
|
||||||
/sys/devices(/platform)?/soc/[a-z0-9]+\.i2c/i2c-[0-9]+/[0-9]+-[a-z0-9]+/[a-z0-9]+\.i2c:qcom,[a-z0-9]+@[a-z0-9]:qcom,smb[a-z0-9]+-parallel-slave@[0-9]+/power_supply/parallel(/.*)? u:object_r:sysfs_usb_supply:s0
|
/sys/devices(/platform)?/soc/[a-z0-9]+\.i2c/i2c-[0-9]+/[0-9]+-[a-z0-9]+/[a-z0-9]+\.i2c:qcom,[a-z0-9]+@[a-z0-9]:qcom,smb[a-z0-9]+-parallel-slave@[0-9]+/power_supply/parallel(/.*)? u:object_r:sysfs_usb_supply:s0
|
||||||
|
|
||||||
|
|
3
sepolicy/vendor/property_contexts
vendored
3
sepolicy/vendor/property_contexts
vendored
|
@ -25,9 +25,6 @@ sys.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
|
||||||
persist.sys.fp.info u:object_r:hal_fingerprint_prop:s0
|
persist.sys.fp.info 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,7 +1,5 @@
|
||||||
allow system_app blkio_dev:dir search;
|
allow system_app blkio_dev:dir search;
|
||||||
allow system_app hal_mlipay_default:binder call;
|
allow system_app hal_mlipay_default:binder call;
|
||||||
allow system_app hall_dev:file rw_file_perms;
|
|
||||||
allow system_app hall_dev:dir search;
|
|
||||||
allow system_app kcal_dev:file rw_file_perms;
|
allow system_app kcal_dev:file rw_file_perms;
|
||||||
allow system_app kcal_dev:dir search;
|
allow system_app kcal_dev:dir search;
|
||||||
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,6 +1,3 @@
|
||||||
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 ir_dev_file:chr_file { create setattr };
|
allow ueventd ir_dev_file:chr_file { create setattr };
|
||||||
allow ueventd kcal_dev:dir r_dir_perms;
|
allow ueventd kcal_dev:dir r_dir_perms;
|
||||||
allow ueventd kcal_dev:file rw_file_perms;
|
allow ueventd kcal_dev:file rw_file_perms;
|
||||||
|
|
Loading…
Reference in a new issue