File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
src/com/android/development Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 34
34
android : layout_height =" wrap_content"
35
35
android : text =" @string/bad_behavior_crash_thread_label" />
36
36
37
+ <Button android : id =" @+id/bad_behavior_crash_native"
38
+ android : layout_width =" wrap_content"
39
+ android : layout_height =" wrap_content"
40
+ android : text =" @string/bad_behavior_crash_native_label" />
41
+
37
42
<Button android : id =" @+id/bad_behavior_wtf"
38
43
android : layout_width =" wrap_content"
39
44
android : layout_height =" wrap_content"
Original file line number Diff line number Diff line change 199
199
<string name =" bad_behavior_crash_system_label" >Crash the system server</string >
200
200
<string name =" bad_behavior_crash_main_label" >Crash the main app thread</string >
201
201
<string name =" bad_behavior_crash_thread_label" >Crash an auxiliary app thread</string >
202
+ <string name =" bad_behavior_crash_native_label" >Crash the native process</string >
202
203
<string name =" bad_behavior_wtf_label" >Report a WTF condition</string >
203
204
<string name =" bad_behavior_anr_label" >ANR (Stop responding for 20 seconds)</string >
204
205
<string name =" bad_behavior_anr_activity_label" >ANR launching a new Activity</string >
Original file line number Diff line number Diff line change 25
25
import android .os .Bundle ;
26
26
import android .os .IBinder ;
27
27
import android .os .IPowerManager ;
28
+ import android .os .Process ;
28
29
import android .os .RemoteException ;
29
30
import android .os .ServiceManager ;
30
31
import android .util .Log ;
@@ -105,6 +106,17 @@ public void onClick(View v) {
105
106
}
106
107
});
107
108
109
+ Button crash_native = (Button ) findViewById (R .id .bad_behavior_crash_native );
110
+ crash_native .setOnClickListener (new View .OnClickListener () {
111
+ public void onClick (View v ) {
112
+ // For some reason, the JVM needs two of these to get the hint
113
+ Log .i (TAG , "Native crash pressed -- about to kill -11 self" );
114
+ Process .sendSignal (Process .myPid (), 11 );
115
+ Process .sendSignal (Process .myPid (), 11 );
116
+ Log .i (TAG , "Finished kill -11, should be dead or dying" );
117
+ }
118
+ });
119
+
108
120
Button wtf = (Button ) findViewById (R .id .bad_behavior_wtf );
109
121
wtf .setOnClickListener (new View .OnClickListener () {
110
122
public void onClick (View v ) { Log .wtf (TAG , "Apps Behaving Badly" ); }
You can’t perform that action at this time.
0 commit comments