summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2022-11-01 14:21:12 +0100
committerArne Schwabe <arne@rfc2549.org>2022-11-01 14:21:12 +0100
commitb109f9f25a9ffbf98cff2a7c1662e5b4fe2c4164 (patch)
tree16e066c6c4372025ed55df1581aee47270481c7e
parent2243146d87311aa75c9c6d3fe120f393db0d75fa (diff)
Avoid warning about passing intent between processes
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/StatusListener.java17
1 files changed, 13 insertions, 4 deletions
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