summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tom Cherry <tomcherry@google.com> 2019-09-19 23:59:07 -0700
committer android-build-merger <android-build-merger@google.com> 2019-09-19 23:59:07 -0700
commit60311e153fe945623c810738e70557dd85b9333f (patch)
tree2fd9693b4891cee30e0fd758ce218f05fb84474b
parente927ca91ad26f479bdfa2509fdf8687e066c57c6 (diff)
parent1a8cd03fbcd83d90240fe9b2f670268b55b27438 (diff)
Merge "Document that SystemProperties.set() can throw RuntimeException" am: 6265eea819 am: 14a2b65e4e am: f5269ed927
am: 1a8cd03fbc Change-Id: I05c785b6f4d653c6f7911765bd2e2b9043488f1a
-rw-r--r--core/java/android/os/SystemProperties.java2
-rw-r--r--core/jni/android_os_SystemProperties.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java
index cdae72ebd313..b6af82948da3 100644
--- a/core/java/android/os/SystemProperties.java
+++ b/core/java/android/os/SystemProperties.java
@@ -189,6 +189,8 @@ public class SystemProperties {
* Set the value for the given {@code key} to {@code val}.
*
* @throws IllegalArgumentException if the {@code val} exceeds 91 characters
+ * @throws RuntimeException if the property cannot be set, for example, if it was blocked by
+ * SELinux. libc will log the underlying reason.
* @hide
*/
@UnsupportedAppUsage
diff --git a/core/jni/android_os_SystemProperties.cpp b/core/jni/android_os_SystemProperties.cpp
index ab5231425b6d..cfdf26abc25c 100644
--- a/core/jni/android_os_SystemProperties.cpp
+++ b/core/jni/android_os_SystemProperties.cpp
@@ -108,7 +108,7 @@ void SystemProperties_set(JNIEnv *env, jobject clazz, jstring keyJ,
if (!ConvertKeyAndForward(env, keyJ, true, handler)) {
// Must have been a failure in SetProperty.
jniThrowException(env, "java/lang/RuntimeException",
- "failed to set system property");
+ "failed to set system property (check logcat for reason)");
}
}