only set intent flag for sdk>=31

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-06-22 11:21:46 +02:00
parent 98a96ef6e4
commit 3096d90bc6
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B

View File

@ -2606,12 +2606,22 @@ public class CallActivity extends CallBaseActivity {
final ArrayList<RemoteAction> actions = new ArrayList<>(); final ArrayList<RemoteAction> actions = new ArrayList<>();
final Icon icon = Icon.createWithResource(this, iconId); final Icon icon = Icon.createWithResource(this, iconId);
final PendingIntent intent = PendingIntent intent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
intent =
PendingIntent.getBroadcast( PendingIntent.getBroadcast(
this, this,
requestCode, requestCode,
new Intent(MICROPHONE_PIP_INTENT_NAME).putExtra(MICROPHONE_PIP_INTENT_EXTRA_ACTION, requestCode), new Intent(MICROPHONE_PIP_INTENT_NAME).putExtra(MICROPHONE_PIP_INTENT_EXTRA_ACTION, requestCode),
FLAG_MUTABLE); FLAG_MUTABLE);
} else {
intent =
PendingIntent.getBroadcast(
this,
requestCode,
new Intent(MICROPHONE_PIP_INTENT_NAME).putExtra(MICROPHONE_PIP_INTENT_EXTRA_ACTION, requestCode),
0);
}
actions.add(new RemoteAction(icon, title, title, intent)); actions.add(new RemoteAction(icon, title, title, intent));