mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-14 02:14:34 -05:00
d2d0c48a25
no effective change: https://review.lineageos.org/q/topic:%22P_asb_2024-05%22 gains 8 patches: https://review.lineageos.org/q/topic:%22Q_asb_2024-06%22 https://review.lineageos.org/q/topic:%22Q_asb_2024-07%22 Signed-off-by: Tavi <tavi@divested.dev>
48 lines
2.0 KiB
Diff
48 lines
2.0 KiB
Diff
From 3ec9c56bd4ac40cf11f00866639b37a955eabc8b Mon Sep 17 00:00:00 2001
|
|
From: Jing Ji <jji@google.com>
|
|
Date: Tue, 25 Oct 2022 22:39:52 -0700
|
|
Subject: [PATCH] DO NOT MERGE: ActivityManager#killBackgroundProcesses can
|
|
kill caller's own app only
|
|
|
|
unless it's a system app.
|
|
|
|
Bug: 239423414
|
|
Bug: 223376078
|
|
Test: atest CtsAppTestCases:ActivityManagerTest
|
|
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d1c95670b248df945784b0f2830acf83b5682de3)
|
|
Merged-In: Iac6baa889965b8ffecd9a43179a4c96632ad1d02
|
|
AOSP-Change-Id: Iac6baa889965b8ffecd9a43179a4c96632ad1d02
|
|
|
|
Change-Id: I3a39b5e2b2ff0c314972ddeccb012894de704de8
|
|
---
|
|
.../server/am/ActivityManagerService.java | 16 ++++++++++++++++
|
|
1 file changed, 16 insertions(+)
|
|
|
|
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
|
|
index 41b1ddaf887bb..bcb7276b4014e 100644
|
|
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
|
|
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
|
|
@@ -4268,6 +4268,22 @@ void killAllBackgroundProcessesExcept(int minTargetSdk, int maxProcState) {
|
|
throw new SecurityException(msg);
|
|
}
|
|
|
|
+ final int callingUid = Binder.getCallingUid();
|
|
+ final int callingPid = Binder.getCallingPid();
|
|
+
|
|
+ ProcessRecord proc;
|
|
+ synchronized (mPidsSelfLocked) {
|
|
+ proc = mPidsSelfLocked.get(callingPid);
|
|
+ }
|
|
+ if (callingUid >= FIRST_APPLICATION_UID
|
|
+ && (proc == null || !proc.info.isSystemApp())) {
|
|
+ final String msg = "Permission Denial: killAllBackgroundProcesses() from pid="
|
|
+ + callingPid + ", uid=" + callingUid + " is not allowed";
|
|
+ Slog.w(TAG, msg);
|
|
+ // Silently return to avoid existing apps from crashing.
|
|
+ return;
|
|
+ }
|
|
+
|
|
final long callingId = Binder.clearCallingIdentity();
|
|
try {
|
|
synchronized (this) {
|