Timer for on/off Android support

Dear Ziellos,

Thank you. At this time not any error messages. However I ignored the empty species between variables. :laughing:

Good idea. But how abt Whatsapp, Telegram, Signal, …

It should only stop when there was no background task launched first, like these messengers have.

Maybe it can stopped partially, so that background tasks can still listening on message-ports.

If you are using situations you can use the this command to stop android support:
dbus-send --system --dest=com.jolla.apk
d --type=method_call /com/jolla/apkd com.jolla.apkd.controlService
boolean:false

2 Likes

Hello Anig!
Yes, then can be started with
defaultuser ALL = NOPASSWD: /usr/bin/dbus-send

I have made something wrong with systemctl, it does not work. However same with earlier d-bus as you teached me. Irritating if something near to succeed in, but it has something wrong with my action.

The previous Schturman batch worked very excellent way in my previous Jolla, Jolla C and Xperia X . And perhaps in XA2, but now interested in to apply in 10 II,

Thus:
The order:
sudo systemctl start / or stop aliendalvik.service works well in terminal, as it should be.
But when I set the order in Situations app as order, it does not work at all.
Same it with this dbus-order, too.

Succeeded in at last long!
Found also this Allow airplane mode in Situations app under Sailfish OS 3 – mascha.me

Then your all helping advices!

Thank you all for help!

1 Like

I’ve found this to be a great idea as I often fall asleep listening to something via YouTube Vanced, which sometimes out of nowhere tends to give very high CPU load and drain battery.

So I made a very simple app that has a slider to select timeout in minutes and then a singleshot QTimer which on timeout makes the following call via DBus:

QDBusMessage mm = QDBusMessage::createMethodCall("com.jolla.apkd",
                                                    "/com/jolla/apkd",
                                                    "com.jolla.apkd",
                                                    "controlService");
mm << false;

QDBusConnection::systemBus().call(mm);

It works perfectly fine, but only if I disable sandboxing in .desktop file using

 Sandboxing=Disabled

Does anyone know what to do (e.g. which permissions to use, or whatever else needs to be done) to make it work with sandboxing enabled?

Does sandboxing somehow block systemBus DBus calls? Does it take some specific permission to allow them? In my other applications DBus calls via sessionBus work just fine with sandboxing enabled, but this systemBus call just has no effect unless I disable sandboxing.

If anyone is using this an extra argument is now needed under 4.6. This works for me:

dbus-send --system --dest=com.jolla.apkd.control --type=method_call /com/jolla/apkd --print-reply com.jolla.apkd.control.controlService boolean:false string:“default”

Hello - in fingerterm its run but in the app situations not. What could be the reason?

Aliendalvik On:
dbus-send --system --dest=com.jolla.apkd.control --type=method_call /com/jolla/apkd --print-reply com.jolla.apkd.control.controlService boolean:true string:“default”

Aliendalvik Off:
dbus-send --system --dest=com.jolla.apkd.control --type=method_call /com/jolla/apkd --print-reply com.jolla.apkd.control.controlService boolean:false string:“default”

Most of them, yes.

However, you can either invent a new Permission file:

e.g. /etc/sailjail/permissions/AndroidControl.permission

# BEG systembus-com.jolla.apkd
dbus-system.talk com.jolla.apkd
dbus-system.call com.jolla.apkd=com.jolla.apkd.controlService@/*
# END systembus-com.jolla.apkd

and then include that in the apps .desktop file permission list:

[...]
[X-Sailjail]
ApplicationName=my-android-control-app
OrganizationName=my-organization
Permissions=AndroidControl

OR you can create an application profile, e.g.

e.g. /etc/sailjail/permissions/my-android-control-app.profile

# -*- mode: sh -*-

# Firejail profile for /usr/bin/my-android-control-app

# x-sailjail-translation-catalog = my-android-control-app
# x-sailjail-translation-key-description = my-android-control-app-la-name
# x-sailjail-description = Android Control
# x-sailjail-translation-key-long-description = my-android-control-permission-la-data_description
# x-sailjail-long-description = Start and stop AppSupport

### PERMISSIONS
# x-sailjail-permission = Privileged

# BEG systembus-com.jolla.apkd
dbus-system.talk com.jolla.apkd
dbus-system.call com.jolla.apkd=com.jolla.apkd.controlService@/*
# END systembus-com.jolla.apkd

I only realised this recently, I created a simple script file called stopAd.sh in the defaultuser folder and made it executable

#!/bin/sh

dbus-send --system --dest=com.jolla.apkd.control --type=method_call /com/jolla/apkd com.jolla.apkd.control.controlService boolean:false string:"default"

In the situation I just execute the script using ./stopAd.sh

1 Like