DivestOS/Patches/LineageOS-18.1/android_packages_apps_LineageParts/311606.patch

57 lines
2.6 KiB
Diff

From 61685846ab27c87dd0646478c4d3c5098d584daa Mon Sep 17 00:00:00 2001
From: Bruno Martins <bgcngm@gmail.com>
Date: Sun, 6 Jun 2021 14:18:24 +0100
Subject: [PATCH] profiles: Add FLAG_IMMUTABLE flag for security purposes
Prevent the intent to be altered by a malicious app.
Change-Id: Id5144fb3f11fc98380de0188df0f32330e976398
---
.../lineageos/lineageparts/profiles/NFCProfileWriter.java | 5 +++--
.../lineageparts/profiles/triggers/NfcTriggerFragment.java | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/org/lineageos/lineageparts/profiles/NFCProfileWriter.java b/src/org/lineageos/lineageparts/profiles/NFCProfileWriter.java
index d477d6969..d651e9b5c 100644
--- a/src/org/lineageos/lineageparts/profiles/NFCProfileWriter.java
+++ b/src/org/lineageos/lineageparts/profiles/NFCProfileWriter.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2012 The CyanogenMod Project
- * 2017-2018 The LineageOS 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.
@@ -84,7 +84,8 @@ protected void onPause() {
private PendingIntent getPendingIntent() {
return PendingIntent.getActivity(this, 0,
- new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
+ new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP),
+ PendingIntent.FLAG_IMMUTABLE);
}
private void disableTagWriteMode() {
diff --git a/src/org/lineageos/lineageparts/profiles/triggers/NfcTriggerFragment.java b/src/org/lineageos/lineageparts/profiles/triggers/NfcTriggerFragment.java
index adb684c32..aac98393c 100644
--- a/src/org/lineageos/lineageparts/profiles/triggers/NfcTriggerFragment.java
+++ b/src/org/lineageos/lineageparts/profiles/triggers/NfcTriggerFragment.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The CyanogenMod Project
- * 2017 The LineageOS Project
+ * 2017,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.
@@ -89,7 +89,7 @@ public void onPause() {
private PendingIntent getPendingIntent() {
Intent intent = new Intent(getActivity(), getActivity().getClass())
.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
- return PendingIntent.getActivity(getActivity(), 0, intent, 0);
+ return PendingIntent.getActivity(getActivity(), 0, intent, PendingIntent.FLAG_IMMUTABLE);
}
private void disableTagWriteMode() {