From 386c3cec21d64129c6dcb71fe05cb4cd0cbc2bca Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Wed, 15 Jan 2020 12:46:10 +0100 Subject: [PATCH] Listen to MY_PACKAGE_REPLACED to restart the service on app upgrades. The old PACKAGE_REPLACED event doesn't work since Oreo [1]. [1] https://developer.android.com/about/versions/oreo/background.html#broadcasts BUG: 416245 --- AndroidManifest.xml | 3 +++ src/org/kde/kdeconnect/KdeConnectBroadcastReceiver.java | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 093c5dce..94e7a49d 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -106,6 +106,9 @@ android:path="/" android:scheme="package" /> + + + diff --git a/src/org/kde/kdeconnect/KdeConnectBroadcastReceiver.java b/src/org/kde/kdeconnect/KdeConnectBroadcastReceiver.java index af3583b7..28c64524 100644 --- a/src/org/kde/kdeconnect/KdeConnectBroadcastReceiver.java +++ b/src/org/kde/kdeconnect/KdeConnectBroadcastReceiver.java @@ -37,6 +37,12 @@ public class KdeConnectBroadcastReceiver extends BroadcastReceiver { String action = intent.getAction(); switch (action) { + case Intent.ACTION_MY_PACKAGE_REPLACED: + Log.i("KdeConnect", "MyUpdateReceiver"); + BackgroundService.RunCommand(context, service -> { + + }); + break; case Intent.ACTION_PACKAGE_REPLACED: Log.i("KdeConnect", "UpdateReceiver"); if (!intent.getData().getSchemeSpecificPart().equals(context.getPackageName())) {