Home | History | Annotate | Download | only in os

Lines Matching refs:key

34  * store contains a list of string key-value pairs.
61 private static void onKeyAccess(String key) {
64 if (key != null && key.startsWith("ro.")) {
66 MutableInt numReads = sRoReads.getOrDefault(key, null);
69 sRoReads.put(key, numReads);
74 + ") of a read-only system property '" + key + "'",
81 private static native String native_get(String key);
82 private static native String native_get(String key, String def);
83 private static native int native_get_int(String key, int def);
84 private static native long native_get_long(String key, long def);
85 private static native boolean native_get_boolean(String key, boolean def);
86 private static native void native_set(String key, String def);
91 * Get the String value for the given {@code key}.
93 * @param key the key to lookup
94 * @return an empty string if the {@code key} isn't found
99 public static String get(@NonNull String key) {
100 if (TRACK_KEY_ACCESS) onKeyAccess(key);
101 return native_get(key);
105 * Get the String value for the given {@code key}.
107 * @param key the key to lookup
109 * @return if the {@code key} isn't found, return {@code def} if it isn't null, or an empty
116 public static String get(@NonNull String key, @Nullable String def) {
117 if (TRACK_KEY_ACCESS) onKeyAccess(key);
118 return native_get(key, def);
122 * Get the value for the given {@code key}, and return as an integer.
124 * @param key the key to lookup
126 * @return the key parsed as an integer, or def if the key isn't found or
131 public static int getInt(@NonNull String key, int def) {
132 if (TRACK_KEY_ACCESS) onKeyAccess(key);
133 return native_get_int(key, def);
137 * Get the value for the given {@code key}, and return as a long.
139 * @param key the key to lookup
141 * @return the key parsed as a long, or def if the key isn't found or
146 public static long getLong(@NonNull String key, long def) {
147 if (TRACK_KEY_ACCESS) onKeyAccess(key);
148 return native_get_long(key, def);
152 * Get the value for the given {@code key}, returned as a boolean.
156 * If the key does not exist, or has any other value, then the default
159 * @param key the key to lookup
161 * @return the key parsed as a boolean, or def if the key isn't found or is
166 public static boolean getBoolean(@NonNull String key, boolean def) {
167 if (TRACK_KEY_ACCESS) onKeyAccess(key);
168 return native_get_boolean(key, def);
172 * Set the value for the given {@code key} to {@code val}.
177 public static void set(@NonNull String key, @Nullable String val) {
179 throw new IllegalArgumentException("value of system property '" + key
182 if (TRACK_KEY_ACCESS) onKeyAccess(key);
183 native_set(key, val);