From 044f04b25f82033adf6768eca126cb08e6e75e2c Mon Sep 17 00:00:00 2001 From: latin-panda <66472237+latin-panda@users.noreply.github.com> Date: Thu, 9 Jun 2022 15:22:18 +0700 Subject: [PATCH] Adding package name to make intents explicit --- .../medicmobile/webapp/mobile/ConnectionErrorActivity.java | 4 +++- .../webapp/mobile/RequestStoragePermissionActivity.java | 1 + src/main/java/org/medicmobile/webapp/mobile/UrlHandler.java | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/medicmobile/webapp/mobile/ConnectionErrorActivity.java b/src/main/java/org/medicmobile/webapp/mobile/ConnectionErrorActivity.java index d3e2b548..b01a6a35 100644 --- a/src/main/java/org/medicmobile/webapp/mobile/ConnectionErrorActivity.java +++ b/src/main/java/org/medicmobile/webapp/mobile/ConnectionErrorActivity.java @@ -53,7 +53,9 @@ public class ConnectionErrorActivity extends ClosableAppActivity { // Retry connection public void onClickRetry(View view) { trace(this, "onClickRetry()"); - sendBroadcast(new Intent("retryConnection")); + Intent intent = new Intent("retryConnection"); + intent.setPackage(this.getPackageName()); + sendBroadcast(intent); showSpinnerLayout(); } diff --git a/src/main/java/org/medicmobile/webapp/mobile/RequestStoragePermissionActivity.java b/src/main/java/org/medicmobile/webapp/mobile/RequestStoragePermissionActivity.java index 77080521..b9fd0e81 100644 --- a/src/main/java/org/medicmobile/webapp/mobile/RequestStoragePermissionActivity.java +++ b/src/main/java/org/medicmobile/webapp/mobile/RequestStoragePermissionActivity.java @@ -98,6 +98,7 @@ private Intent createResponseIntent() { Intent requestIntent = getIntent(); String triggerClass = requestIntent == null ? null : requestIntent.getStringExtra(this.TRIGGER_CLASS); Intent responseIntent = new Intent(); + responseIntent.setPackage(this.getPackageName()); responseIntent.putExtra(this.TRIGGER_CLASS, triggerClass); return responseIntent; } diff --git a/src/main/java/org/medicmobile/webapp/mobile/UrlHandler.java b/src/main/java/org/medicmobile/webapp/mobile/UrlHandler.java index 2e9fbfaf..a5741577 100644 --- a/src/main/java/org/medicmobile/webapp/mobile/UrlHandler.java +++ b/src/main/java/org/medicmobile/webapp/mobile/UrlHandler.java @@ -142,6 +142,8 @@ private void startConnectionErrorActivity(WebView view, int errorCode, String er trace(this, "onPageFinished() :: url: %s", url); // Broadcast the event so if the connection error // activity is listening it will close - this.parentActivity.sendBroadcast(new Intent("onPageFinished")); + Intent intent = new Intent("onPageFinished"); + intent.setPackage(this.parentActivity.getPackageName()); + this.parentActivity.sendBroadcast(intent); } }