summaryrefslogtreecommitdiff
path: root/core/java/android/os/SystemProperties.java
diff options
context:
space:
mode:
authorMakoto Onuki <omakoto@google.com>2018-10-02 16:00:56 -0700
committerMakoto Onuki <omakoto@google.com>2018-10-02 16:00:56 -0700
commitf0cc59d695a8ea45a9b400fc4d12eca7b7129f95 (patch)
tree394065994355aedab29bfe7a5cc26bf1e251b4fb /core/java/android/os/SystemProperties.java
parent23961c8a8057d42b8c11345dd18c87fa0748fc8c (diff)
Clear calling identity before calling SysProp callbacks
Test: boot, run any "setprop" on adb shell Change-Id: I4aa16b60bfad9dfe3a64fa5a629caf83dce1c8bd Fixes: 117105159
Diffstat (limited to 'core/java/android/os/SystemProperties.java')
-rw-r--r--core/java/android/os/SystemProperties.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java
index fb34a524f625..bdc776dd3702 100644
--- a/core/java/android/os/SystemProperties.java
+++ b/core/java/android/os/SystemProperties.java
@@ -208,13 +208,18 @@ public class SystemProperties {
return;
}
ArrayList<Runnable> callbacks = new ArrayList<Runnable>(sChangeCallbacks);
- for (int i=0; i<callbacks.size(); i++) {
- try {
- callbacks.get(i).run();
- } catch (Throwable t) {
- Log.wtf(TAG, "Exception in SystemProperties change callback", t);
- // Ignore and try to go on.
+ final long token = Binder.clearCallingIdentity();
+ try {
+ for (int i = 0; i < callbacks.size(); i++) {
+ try {
+ callbacks.get(i).run();
+ } catch (Throwable t) {
+ Log.wtf(TAG, "Exception in SystemProperties change callback", t);
+ // Ignore and try to go on.
+ }
}
+ } finally {
+ Binder.restoreCallingIdentity(token);
}
}
}