Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Crash when tapping on Notification action button in Android 12 #1548

Merged
merged 2 commits into from
Apr 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ private static void handleDismissFromActionButtonPress(Context context, Intent i
// Pressed an action button, need to clear the notification and close the notification area manually.
if (intent.getBooleanExtra("action_button", false)) {
NotificationManagerCompat.from(context).cancel(intent.getIntExtra(BUNDLE_KEY_ANDROID_NOTIFICATION_ID, 0));
context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

// Only close the notifications shade on Android versions where it is allowed, Android 11 and lower.
// See https://developer.android.com/about/versions/12/behavior-changes-all#close-system-dialogs
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.S) {
context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
}
}
}

Expand Down