sdm660-common: XiaomiParts: Start folio_daemon only if a prop is set
This commit is contained in:
parent
3f18f27baf
commit
25dadea83b
7 changed files with 29 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018 The Xiaomi-SDM660 Project
|
||||
* Copyright (C) 2018-2019 The Xiaomi-SDM660 Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -59,6 +59,8 @@ public class BootReceiver extends BroadcastReceiver implements Utils {
|
|||
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);
|
||||
context.startService(new Intent(context, DiracService.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018 The Xiaomi-SDM660 Project
|
||||
* Copyright (C) 2018-2019 The Xiaomi-SDM660 Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -52,6 +52,7 @@ public class DeviceSettings extends PreferenceFragment implements
|
|||
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 = "vendor.persist.hall_wakeup";
|
||||
|
||||
private static final String DEVICE_DOZE_PACKAGE_NAME = "org.lineageos.settings.doze";
|
||||
|
||||
|
@ -160,6 +161,7 @@ public class DeviceSettings extends PreferenceFragment implements
|
|||
|
||||
case PREF_HALL_WAKEUP:
|
||||
FileUtils.setValue(HALL_WAKEUP_PATH, (boolean) value ? "Y" : "N");
|
||||
FileUtils.setProp(HALL_WAKEUP_PROP, (boolean) value);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018 The Xiaomi-SDM660 Project
|
||||
* Copyright (C) 2018-2019 The Xiaomi-SDM660 Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.lineageos.settings.device;
|
||||
|
||||
import android.os.SystemProperties;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -112,4 +114,12 @@ public class FileUtils {
|
|||
// ignore
|
||||
return line;
|
||||
}
|
||||
|
||||
static void setProp(String prop, boolean value) {
|
||||
if (value) {
|
||||
SystemProperties.set(prop, "1");
|
||||
} else {
|
||||
SystemProperties.set(prop, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,12 +158,12 @@ service folio_daemon /system/bin/folio_daemon
|
|||
group system uhid
|
||||
disabled
|
||||
|
||||
on property:init.svc.zygote=running
|
||||
start folio_daemon
|
||||
|
||||
on property:init.svc.zygote=stopped
|
||||
on property:vendor.persist.hall_wakeup=0
|
||||
stop folio_daemon
|
||||
|
||||
on property:vendor.persist.hall_wakeup=1
|
||||
start folio_daemon
|
||||
|
||||
#Peripheral manager
|
||||
service vendor.per_mgr /system/vendor/bin/pm-service
|
||||
class core
|
||||
|
|
3
sepolicy/vendor/property.te
vendored
3
sepolicy/vendor/property.te
vendored
|
@ -9,3 +9,6 @@ type thermal_engine_prop, property_type;
|
|||
|
||||
# Dirac
|
||||
type dirac_prop, property_type;
|
||||
|
||||
# Hall wakeup
|
||||
type hall_wakeup_prop, property_type;
|
||||
|
|
3
sepolicy/vendor/property_contexts
vendored
3
sepolicy/vendor/property_contexts
vendored
|
@ -37,3 +37,6 @@ persist.audio.dirac. u:object_r:dirac_prop:s0
|
|||
|
||||
# MPCTL
|
||||
sys.post_boot.parsed u:object_r:vendor_mpctl_prop:s0
|
||||
|
||||
# Hall wakeup
|
||||
vendor.persist.hall_wakeup u:object_r:hall_wakeup_prop:s0
|
||||
|
|
2
sepolicy/vendor/system_app.te
vendored
2
sepolicy/vendor/system_app.te
vendored
|
@ -9,3 +9,5 @@ allow system_app sysfs_thermal:file rw_file_perms;
|
|||
allow system_app sysfs_thermal:dir search;
|
||||
allow system_app sysfs_vibrator:file rw_file_perms;
|
||||
allow system_app sysfs_vibrator:dir search;
|
||||
|
||||
set_prop(system_app, hall_wakeup_prop);
|
||||
|
|
Loading…
Reference in a new issue