Skip to content

Commit feecf9d

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Support for changing traces from development settings." into jb-dev
2 parents 8c68012 + 83e6eb1 commit feecf9d

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

core/java/android/os/Trace.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ public final class Trace {
3939
public static final long TRACE_TAG_SYNC_MANAGER = 1L << 7;
4040
public static final long TRACE_TAG_AUDIO = 1L << 8;
4141

42+
public static final int TRACE_FLAGS_START_BIT = 1;
43+
public static final String[] TRACE_TAGS = {
44+
"Graphics", "Input", "View", "WebView", "Window Manager",
45+
"Activity Manager", "Sync Manager", "Audio"
46+
};
47+
48+
public static final String PROPERTY_TRACE_TAG_ENABLEFLAGS = "debug.atrace.tags.enableflags";
49+
4250
private static final long sEnabledTags = nativeGetEnabledTags();
4351

4452
private static native long nativeGetEnabledTags();

core/java/android/preference/MultiCheckPreference.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,24 @@ private void setEntryValuesCS(CharSequence[] values) {
136136
*
137137
* @return The array of values.
138138
*/
139-
public CharSequence[] getEntryValues() {
139+
public String[] getEntryValues() {
140140
return mEntryValues;
141141
}
142142

143+
/**
144+
* Get the boolean state of a given value.
145+
*/
146+
public boolean getValue(int index) {
147+
return mSetValues[index];
148+
}
149+
150+
/**
151+
* Set the boolean state of a given value.
152+
*/
153+
public void setValue(int index, boolean state) {
154+
mSetValues[index] = state;
155+
}
156+
143157
/**
144158
* Sets the current values.
145159
*/

core/jni/android_os_SystemProperties.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static jint SystemProperties_get_int(JNIEnv *env, jobject clazz,
6565
int len;
6666
const char* key;
6767
char buf[PROPERTY_VALUE_MAX];
68+
char* end;
6869
jint result = defJ;
6970

7071
if (keyJ == NULL) {
@@ -76,9 +77,10 @@ static jint SystemProperties_get_int(JNIEnv *env, jobject clazz,
7677

7778
len = property_get(key, buf, "");
7879
if (len > 0) {
79-
jint temp;
80-
if (sscanf(buf, "%d", &temp) == 1)
81-
result = temp;
80+
result = strtol(buf, &end, 0);
81+
if (end == buf) {
82+
result = defJ;
83+
}
8284
}
8385

8486
env->ReleaseStringUTFChars(keyJ, key);
@@ -93,6 +95,7 @@ static jlong SystemProperties_get_long(JNIEnv *env, jobject clazz,
9395
int len;
9496
const char* key;
9597
char buf[PROPERTY_VALUE_MAX];
98+
char* end;
9699
jlong result = defJ;
97100

98101
if (keyJ == NULL) {
@@ -104,9 +107,10 @@ static jlong SystemProperties_get_long(JNIEnv *env, jobject clazz,
104107

105108
len = property_get(key, buf, "");
106109
if (len > 0) {
107-
jlong temp;
108-
if (sscanf(buf, "%lld", &temp) == 1)
109-
result = temp;
110+
result = strtoll(buf, &end, 0);
111+
if (end == buf) {
112+
result = defJ;
113+
}
110114
}
111115

112116
env->ReleaseStringUTFChars(keyJ, key);

0 commit comments

Comments
 (0)