Skip to content
Snippets Groups Projects
Verified Commit f324999c authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

Bug 41481: Update PendingIntent for Android 12+

parent 20738f8d
Branches bug_41481
No related tags found
No related merge requests found
......@@ -142,17 +142,25 @@ public final class TorService extends Service implements TorServiceConstants, Or
}
intent.setAction(TorServiceConstants.TOR_APP_USERNAME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);
int flags = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
flags = flags | PendingIntent.FLAG_IMMUTABLE;
}
PendingIntent pendIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, flags);
if (mNotifyBuilder == null) {
mNotifyBuilder = new NotificationBuilderCompat(this, NOTIFICATION_CHANNEL_ID)
.setContentTitle(getString(R.string.app_name)).setContentIntent(pendIntent).setCategory("service")
.setSmallIcon(R.drawable.ic_stat_tor);
flags = PendingIntent.FLAG_UPDATE_CURRENT;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
flags = flags | PendingIntent.FLAG_IMMUTABLE;
}
Intent intentRefresh = new Intent(CMD_NEWNYM);
PendingIntent pendingIntentNewNym = PendingIntent.getBroadcast(getApplicationContext
(), 0,
intentRefresh, PendingIntent.FLAG_UPDATE_CURRENT);
intentRefresh, flags);
mNotifyBuilder.addAction(R.drawable.ic_refresh_white_24dp, getString(R.string
.menu_new_identity),
pendingIntentNewNym);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment