From decea278c8cdb6120599ac7b5e17c584d3777576 Mon Sep 17 00:00:00 2001 From: althafvly Date: Thu, 14 Sep 2023 22:28:47 +0530 Subject: [PATCH 1/2] Etar: Build as platform app This also allows to use this permission, which was causing a crash in android 12 and up java.lang.RuntimeException: Unable to start receiver com.android.calendar.alerts.AlertReceiver: java.lang.SecurityException: Permission Denial: android.intent.action.CLOSE_SYSTEM_DIALOGS broadcast from foundation.e.calendar (pid=4466, uid=10186) requires android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS. --- Android.bp | 2 ++ app/src/main/AndroidManifest.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/Android.bp b/Android.bp index 8be026998..54c955354 100644 --- a/Android.bp +++ b/Android.bp @@ -15,6 +15,8 @@ android_app { product_specific: true, + certificate: "platform", + static_libs: [ "android-common", "android-opt-timezonepicker", diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e7d82796a..fa2548703 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,6 +21,7 @@ package="ws.xsoh.etar" android:installLocation="auto"> + -- GitLab From 81e142651cad26d51b00123818c299689c0d91a3 Mon Sep 17 00:00:00 2001 From: althafvly Date: Thu, 21 Sep 2023 17:19:12 +0530 Subject: [PATCH 2/2] Etar: Add workaround for Notification trampoline --- .../com/android/calendar/alerts/AlertReceiver.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/com/android/calendar/alerts/AlertReceiver.java b/app/src/main/java/com/android/calendar/alerts/AlertReceiver.java index 26006d5a7..f10e3d3f7 100644 --- a/app/src/main/java/com/android/calendar/alerts/AlertReceiver.java +++ b/app/src/main/java/com/android/calendar/alerts/AlertReceiver.java @@ -22,6 +22,7 @@ import static com.android.calendar.alerts.AlertService.ALERT_CHANNEL_ID; import android.app.Notification; import android.app.PendingIntent; import android.app.Service; +import android.app.TaskStackBuilder; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ContentUris; @@ -676,6 +677,15 @@ public class AlertReceiver extends BroadcastReceiver { geoIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // If this intent cannot be handled, do not create the map action if (isResolveIntent(context, geoIntent)) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context); + geoIntent = createMapActivityIntent(context, urlSpans); + if (geoIntent != null) { + taskStackBuilder.addNextIntentWithParentStack(geoIntent); + return taskStackBuilder.getPendingIntent(0, + PendingIntent.FLAG_UPDATE_CURRENT | Utils.PI_FLAG_IMMUTABLE); + } + } Intent broadcastIntent = new Intent(MAP_ACTION); broadcastIntent.setClass(context, AlertReceiver.class); broadcastIntent.putExtra(EXTRA_EVENT_ID, eventId); -- GitLab