From b109f9f25a9ffbf98cff2a7c1662e5b4fe2c4164 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 1 Nov 2022 14:21:12 +0100 Subject: Avoid warning about passing intent between processes --- .../java/de/blinkt/openvpn/core/StatusListener.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'main') diff --git a/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java b/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java index 500cc5e7..293a6fd4 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java +++ b/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java @@ -5,11 +5,8 @@ package de.blinkt.openvpn.core; -import static android.app.ApplicationExitInfo.REASON_CRASH_NATIVE; - import android.app.ActivityManager; import android.app.ApplicationExitInfo; -import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -44,7 +41,19 @@ public class StatusListener implements VpnStatus.LogListener { @Override public void updateStateString(String state, String msg, int resid, ConnectionStatus level, Intent intent) throws RemoteException { - VpnStatus.updateStateString(state, msg, resid, level, intent); + Intent newIntent = reCreateIntent(intent); + VpnStatus.updateStateString(state, msg, resid, level, newIntent); + } + + private Intent reCreateIntent(Intent intent) { + /* To avoid UnsafeIntentLaunchViolation we recreate the intent that we passed + * to ourselves via the AIDL interface */ + if (intent == null) + return null; + Intent newIntent = new Intent(intent.getAction(), intent.getData()); + if (intent.getExtras() != null) + newIntent.putExtras(intent.getExtras()); + return newIntent; } @Override -- cgit v1.2.3