Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c53de69 authored by Hung-ying Tyan's avatar Hung-ying Tyan
Browse files

Stop a daemon before starting it

in case the daemon is not cleaned up in last session.
parent a8d5644b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -106,6 +106,13 @@ public class AndroidServiceProxy extends ProcessProxy {
    @Override
    protected void performTask() throws IOException {
        String svc = mServiceName;
        Log.d(mTag, "-----  Stop the daemon just in case: " + mServiceName);
        SystemProperties.set(SVC_STOP_CMD, mServiceName);
        if (!blockUntil(SVC_STATE_STOPPED, 5)) {
            throw new IOException("cannot start service anew: " + svc
                    + ", it is still running");
        }

        Log.d(mTag, "+++++  Start: " + svc);
        SystemProperties.set(SVC_START_CMD, svc);

+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ public class VpnServiceBinder extends Service {
    public void onStart (Intent intent, int startId) {
        super.onStart(intent, startId);
        setForeground(true);
        android.util.Log.d("VpnServiceBinder", "becomes a foreground service");
    }

    public IBinder onBind(Intent intent) {