for my battInfo helper app for Xperia 10 V (until sony/jolla will fix battery status) i looking if there is better solution to poweroff phone within app than using privileged perms?
(yes, perhaps making patch for some system qml like StatusArea.qml or some other with timer may be the better solution, but actually i have no time for that now
)
reason: people asking for this because they may not hear low battery notification or they may sleep or just be away from phone…
desktop file:
Permissions=Privileged
the whorking code:
if (getBatteryPercent() < 1) dsmeDbus.powerOff();
.....
DBusInterface {
id: dsmeDbus
bus: DBus.SystemBus
service: "com.nokia.dsme"
path: "/com/nokia/dsme/request"
iface: "com.nokia.dsme.request"
function powerOff() {
dsmeDbus.call("req_shutdown", [],
function(success) {
console.log("req_shutdown OK, powering off")
},
function(error, message) {
console.info("Error occured when entering to shutdown: ", error, "message:", message)
}
)
}
}