lineage-sdk: Mark all pending intents as immutable

* Prepare for S behavior change.

Change-Id: Iea263c300b235bb7306457e27e8cacf2e76c8fa2
This commit is contained in:
Han Wang
2021-06-17 04:48:48 +02:00
committed by Bruno Martins
parent 1416383888
commit ad35709dbd
4 changed files with 10 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 The LineageOS Project
* Copyright (C) 2018-2021 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -126,7 +126,8 @@ public class TrustInterfaceService extends LineageSystemService {
Intent mainIntent = new Intent(INTENT_PARTS);
mainIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pMainIntent = PendingIntent.getActivity(mContext, 0, mainIntent, 0);
PendingIntent pMainIntent = PendingIntent.getActivity(mContext, 0, mainIntent,
PendingIntent.FLAG_IMMUTABLE);
Intent actionIntent = new Intent(INTENT_PARTS);
actionIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 The CyanogenMod Project
* 2019-2021 The LineageOS Project
* 2017-2019,2021 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -545,8 +545,8 @@ public class LiveDisplayService extends LineageSystemService {
if (counter == 0) {
//show the notification and don't come back here
final Intent intent = new Intent(LineageSettings.ACTION_LIVEDISPLAY_SETTINGS);
PendingIntent result = PendingIntent.getActivity(
mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent result = PendingIntent.getActivity(mContext, 0, intent,
PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
Notification.Builder builder = new Notification.Builder(mContext)
.setContentTitle(mContext.getResources().getString(
org.lineageos.platform.internal.R.string.live_display_title))

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The Android Open Source Project
* 2017-2018,2021 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -395,7 +396,7 @@ public final class TwilightTracker {
Intent updateIntent = new Intent(ACTION_UPDATE_TWILIGHT_STATE);
PendingIntent pendingIntent = PendingIntent.getBroadcast(
mContext, 0, updateIntent, 0);
mContext, 0, updateIntent, PendingIntent.FLAG_IMMUTABLE);
mAlarmManager.cancel(pendingIntent);
mAlarmManager.setExact(AlarmManager.RTC, nextUpdate, pendingIntent);
}

View File

@@ -85,7 +85,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse("tel:2813308004"));
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
PendingIntent.FLAG_IMMUTABLE);
RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.tile_remote_view);
remoteViews.setOnClickPendingIntent(R.id.remote_view_button, pendingIntent);