summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anna Bauza <annabauza@google.com> 2024-10-21 14:11:14 +0000
committer Anna Bauza <annabauza@google.com> 2024-10-21 14:11:14 +0000
commit2eb0812f6cb18ab01d8b066b70a265b4b1af6348 (patch)
tree8f0774b067ce82fc458f3bf41536812fac79dc07
parent42cdae92b9a9fb024c17fa6615e3671a89464b89 (diff)
Revert^2 "Add condition to bypass caching when process uid differs from caller uid."
This reverts commit 4e53a549f390bada4ccb70d79f512892c9fbbf27. Reason for revert: This is not fixing the bug just covering up possible issue in Android OS. Please fix the tests, or actual issue. Change-Id: I3db74d1aadfc7652f068483478589a343e60d89b
-rw-r--r--core/java/android/app/PropertyInvalidatedCache.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/java/android/app/PropertyInvalidatedCache.java b/core/java/android/app/PropertyInvalidatedCache.java
index e4d3baa2f05a..acedef0c7788 100644
--- a/core/java/android/app/PropertyInvalidatedCache.java
+++ b/core/java/android/app/PropertyInvalidatedCache.java
@@ -21,11 +21,13 @@ import static android.text.TextUtils.formatSimple;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
+import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.ParcelFileDescriptor;
+import android.os.Process;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.text.TextUtils;
@@ -78,10 +80,15 @@ public class PropertyInvalidatedCache<Query, Result> {
public abstract @Nullable R apply(@NonNull Q query);
/**
- * Return true if a query should not use the cache. The default implementation
- * always uses the cache.
+ * Return true if a query should not use the cache. The default implementation returns true
+ * if the process UID differs from the calling UID. This is to prevent a binder caller from
+ * reading a cached value created due to a different binder caller, when processes are
+ * caching on behalf of other processes.
*/
public boolean shouldBypassCache(@NonNull Q query) {
+ if(android.multiuser.Flags.propertyInvalidatedCacheBypassMismatchedUids()) {
+ return Binder.getCallingUid() != Process.myUid();
+ }
return false;
}
};