mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-11 00:44:23 -05:00
082bc48c32
https://review.lineageos.org/q/topic:P_asb_2022-05 https://review.lineageos.org/q/topic:P_asb_2022-06 https://review.lineageos.org/q/topic:P_asb_2022-07 https://review.lineageos.org/q/topic:P_asb_2022-08 https://review.lineageos.org/q/topic:P_asb_2022-09 https://review.lineageos.org/q/topic:P_asb_2022-10 https://review.lineageos.org/q/topic:P_asb_2022-11 https://review.lineageos.org/q/topic:P_asb_2022-12 https://review.lineageos.org/q/topic:P_asb_2023-01 https://review.lineageos.org/q/topic:P_asb_2023-02 https://review.lineageos.org/q/topic:P_asb_2023-03 https://review.lineageos.org/q/topic:P_asb_2023-04 https://review.lineageos.org/q/topic:P_asb_2023-05 https://review.lineageos.org/q/topic:P_asb_2023-06 https://review.lineageos.org/q/topic:P_asb_2023-07 accounted for via manifest change: https://review.lineageos.org/c/LineageOS/android_external_freetype/+/361250 https://review.lineageos.org/q/topic:P_asb_2023-08 accounted for via manifest change: https://review.lineageos.org/c/LineageOS/android_external_freetype/+/364606 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/365328 https://review.lineageos.org/q/topic:P_asb_2023-09 https://review.lineageos.org/q/topic:P_asb_2023-10 https://review.lineageos.org/q/topic:P_asb_2023-11 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/374916 https://review.lineageos.org/q/topic:P_asb_2023-12 https://review.lineageos.org/q/topic:P_asb_2024-01 https://review.lineageos.org/q/topic:P_asb_2024-02 https://review.lineageos.org/q/topic:P_asb_2024-03 https://review.lineageos.org/q/topic:P_asb_2024-04 Signed-off-by: Tavi <tavi@divested.dev>
76 lines
3.1 KiB
Diff
76 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Makoto Onuki <omakoto@google.com>
|
|
Date: Tue, 19 Apr 2022 10:54:18 -0700
|
|
Subject: [PATCH] Only allow the system server to connect to sync adapters
|
|
|
|
Bug: 203229608
|
|
Test: Manual test with changing the check logic + debug log
|
|
Change-Id: If18009f61360564d02dcda9b1e5fa15685e3250f
|
|
(cherry picked from commit 58270527d11ac7e5f07d337a402d8edf046a63ee)
|
|
(cherry picked from commit 7d1397a54475ed7fee632339ef7c60b432f0fbff)
|
|
Merged-In: If18009f61360564d02dcda9b1e5fa15685e3250f
|
|
---
|
|
.../content/AbstractThreadedSyncAdapter.java | 20 +++++++++++++++++++
|
|
1 file changed, 20 insertions(+)
|
|
|
|
diff --git a/core/java/android/content/AbstractThreadedSyncAdapter.java b/core/java/android/content/AbstractThreadedSyncAdapter.java
|
|
index a086a308d0d9..da4ecdd8c1f2 100644
|
|
--- a/core/java/android/content/AbstractThreadedSyncAdapter.java
|
|
+++ b/core/java/android/content/AbstractThreadedSyncAdapter.java
|
|
@@ -21,6 +21,7 @@ import static com.android.internal.util.function.pooled.PooledLambda.obtainMessa
|
|
import android.accounts.Account;
|
|
import android.annotation.MainThread;
|
|
import android.annotation.NonNull;
|
|
+import android.os.Binder;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
@@ -171,8 +172,20 @@ public abstract class AbstractThreadedSyncAdapter {
|
|
}
|
|
|
|
private class ISyncAdapterImpl extends ISyncAdapter.Stub {
|
|
+ private boolean isCallerSystem() {
|
|
+ final long callingUid = Binder.getCallingUid();
|
|
+ if (callingUid != Process.SYSTEM_UID) {
|
|
+ android.util.EventLog.writeEvent(0x534e4554, "203229608", -1, "");
|
|
+ return false;
|
|
+ }
|
|
+ return true;
|
|
+ }
|
|
+
|
|
@Override
|
|
public void onUnsyncableAccount(ISyncAdapterUnsyncableAccountCallback cb) {
|
|
+ if (!isCallerSystem()) {
|
|
+ return;
|
|
+ }
|
|
Handler.getMain().sendMessage(obtainMessage(
|
|
AbstractThreadedSyncAdapter::handleOnUnsyncableAccount,
|
|
AbstractThreadedSyncAdapter.this, cb));
|
|
@@ -181,12 +194,16 @@ public abstract class AbstractThreadedSyncAdapter {
|
|
@Override
|
|
public void startSync(ISyncContext syncContext, String authority, Account account,
|
|
Bundle extras) {
|
|
+ if (!isCallerSystem()) {
|
|
+ return;
|
|
+ }
|
|
if (ENABLE_LOG) {
|
|
if (extras != null) {
|
|
extras.size(); // Unparcel so its toString() will show the contents.
|
|
}
|
|
Log.d(TAG, "startSync() start " + authority + " " + account + " " + extras);
|
|
}
|
|
+
|
|
try {
|
|
final SyncContext syncContextClient = new SyncContext(syncContext);
|
|
|
|
@@ -242,6 +259,9 @@ public abstract class AbstractThreadedSyncAdapter {
|
|
|
|
@Override
|
|
public void cancelSync(ISyncContext syncContext) {
|
|
+ if (!isCallerSystem()) {
|
|
+ return;
|
|
+ }
|
|
try {
|
|
// synchronize to make sure that mSyncThreads doesn't change between when we
|
|
// check it and when we use it
|