Add a native crash facility to Bad Behavior.

This commit is contained in:
Dan Egnor
2010-01-27 15:10:58 -08:00
parent 2086587ba4
commit 4903dae035
3 changed files with 18 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
import android.os.IPowerManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
@@ -105,6 +106,17 @@ public class BadBehaviorActivity extends Activity {
}
});
Button crash_native = (Button) findViewById(R.id.bad_behavior_crash_native);
crash_native.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// For some reason, the JVM needs two of these to get the hint
Log.i(TAG, "Native crash pressed -- about to kill -11 self");
Process.sendSignal(Process.myPid(), 11);
Process.sendSignal(Process.myPid(), 11);
Log.i(TAG, "Finished kill -11, should be dead or dying");
}
});
Button wtf = (Button) findViewById(R.id.bad_behavior_wtf);
wtf.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { Log.wtf(TAG, "Apps Behaving Badly"); }