sdm660-common: XiaomiParts: Start folio_daemon only if a prop is set

This commit is contained in:
Stylogey 2019-12-12 17:46:42 +01:00 committed by Max Weffers
parent 3f18f27baf
commit 25dadea83b
No known key found for this signature in database
GPG key ID: 795F73D22FB93FAE
7 changed files with 29 additions and 7 deletions

View file

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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)); context.getContentResolver(), DeviceSettings.PREF_THERMAL));
FileUtils.setValue(DeviceSettings.HALL_WAKEUP_PATH, Settings.Secure.getInt( FileUtils.setValue(DeviceSettings.HALL_WAKEUP_PATH, Settings.Secure.getInt(
context.getContentResolver(), DeviceSettings.PREF_HALL_WAKEUP, 1) == 1 ? "Y" : "N"); 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)); context.startService(new Intent(context, DiracService.class));
} }
} }

View file

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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"; private static final String CATEGORY_HALL_WAKEUP = "hall_wakeup";
public static final String PREF_HALL_WAKEUP = "hall"; 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_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"; 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: case PREF_HALL_WAKEUP:
FileUtils.setValue(HALL_WAKEUP_PATH, (boolean) value ? "Y" : "N"); FileUtils.setValue(HALL_WAKEUP_PATH, (boolean) value ? "Y" : "N");
FileUtils.setProp(HALL_WAKEUP_PROP, (boolean) value);
break; break;
default: default:

View file

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,6 +16,8 @@
package org.lineageos.settings.device; package org.lineageos.settings.device;
import android.os.SystemProperties;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -112,4 +114,12 @@ public class FileUtils {
// ignore // ignore
return line; return line;
} }
static void setProp(String prop, boolean value) {
if (value) {
SystemProperties.set(prop, "1");
} else {
SystemProperties.set(prop, "0");
}
}
} }

View file

@ -158,12 +158,12 @@ service folio_daemon /system/bin/folio_daemon
group system uhid group system uhid
disabled disabled
on property:init.svc.zygote=running on property:vendor.persist.hall_wakeup=0
start folio_daemon
on property:init.svc.zygote=stopped
stop folio_daemon stop folio_daemon
on property:vendor.persist.hall_wakeup=1
start folio_daemon
#Peripheral manager #Peripheral manager
service vendor.per_mgr /system/vendor/bin/pm-service service vendor.per_mgr /system/vendor/bin/pm-service
class core class core

View file

@ -9,3 +9,6 @@ type thermal_engine_prop, property_type;
# Dirac # Dirac
type dirac_prop, property_type; type dirac_prop, property_type;
# Hall wakeup
type hall_wakeup_prop, property_type;

View file

@ -37,3 +37,6 @@ persist.audio.dirac. u:object_r:dirac_prop:s0
# MPCTL # MPCTL
sys.post_boot.parsed u:object_r:vendor_mpctl_prop:s0 sys.post_boot.parsed u:object_r:vendor_mpctl_prop:s0
# Hall wakeup
vendor.persist.hall_wakeup u:object_r:hall_wakeup_prop:s0

View file

@ -9,3 +9,5 @@ allow system_app sysfs_thermal:file rw_file_perms;
allow system_app sysfs_thermal:dir search; allow system_app sysfs_thermal:dir search;
allow system_app sysfs_vibrator:file rw_file_perms; allow system_app sysfs_vibrator:file rw_file_perms;
allow system_app sysfs_vibrator:dir search; allow system_app sysfs_vibrator:dir search;
set_prop(system_app, hall_wakeup_prop);