am d0225ee6: Remove the old Dev Tools exception browser (since it relies on now eliminated checkin database crash storage functionality).
Merge commit 'd0225ee63f305ef59e17f8ad0dc16b2ef5e85af0' into eclair-mr2-plus-aosp * commit 'd0225ee63f305ef59e17f8ad0dc16b2ef5e85af0': Remove the old Dev Tools exception browser (since it relies on
This commit is contained in:
@@ -58,13 +58,6 @@
|
||||
<category android:name="android.intent.category.TEST" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="ExceptionBrowser" android:label="Exception Browser">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.TEST" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="StacktraceViewer" android:label="Stacktrace Viewer"/>
|
||||
<activity android:name="PackageSummary" android:label="Package Summary">
|
||||
</activity>
|
||||
<activity android:name="ShowActivity" android:label="Activity">
|
||||
@@ -167,5 +160,11 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="BadBehaviorActivity" android:label="Bad Behavior">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.TEST" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
37
apps/Development/res/layout/bad_behavior.xml
Normal file
37
apps/Development/res/layout/bad_behavior.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2009 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<Button android:id="@+id/bad_behavior_crash_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bad_behavior_crash_main_label" />
|
||||
|
||||
<Button android:id="@+id/bad_behavior_crash_thread"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bad_behavior_crash_thread_label" />
|
||||
|
||||
<Button android:id="@+id/bad_behavior_anr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bad_behavior_anr_label" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -193,4 +193,9 @@
|
||||
<string name="binding_bind_failed">Bind failed</string>
|
||||
<string name="binding_waiting_for_connection">Waiting for service to be connected...</string>
|
||||
<string name="select_account_to_sync">Select account to sync</string>
|
||||
|
||||
<!-- BadBehaviorActivity -->
|
||||
<string name="bad_behavior_crash_main_label">Crash the main thread</string>
|
||||
<string name="bad_behavior_crash_thread_label">Crash an auxiliary thread</string>
|
||||
<string name="bad_behavior_anr_label">Stop responding for 20 seconds (ANR)</string>
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.development;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.view.View;
|
||||
|
||||
public class BadBehaviorActivity extends Activity {
|
||||
static class BadBehaviorException extends RuntimeException {
|
||||
BadBehaviorException() {
|
||||
super("Whatcha gonna do, whatcha gonna do",
|
||||
new IllegalStateException("When they come for you"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
setContentView(R.layout.bad_behavior);
|
||||
|
||||
Button crash_main = (Button) findViewById(R.id.bad_behavior_crash_main);
|
||||
crash_main.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) { throw new BadBehaviorException(); }
|
||||
});
|
||||
|
||||
Button crash_thread = (Button) findViewById(R.id.bad_behavior_crash_thread);
|
||||
crash_thread.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() { throw new BadBehaviorException(); }
|
||||
}.start();
|
||||
}
|
||||
});
|
||||
|
||||
Button anr = (Button) findViewById(R.id.bad_behavior_anr);
|
||||
anr.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
Thread.sleep(20000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
/*
|
||||
** Copyright 2007, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.development;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.provider.Checkin;
|
||||
import android.server.data.CrashData;
|
||||
import android.server.data.ThrowableData;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.KeyEvent;
|
||||
import android.widget.*;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ExceptionBrowser extends ListActivity {
|
||||
/** Logging identifier. */
|
||||
private static final String TAG = "ExceptionBrowser";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
Cursor cursor = getContentResolver().query(
|
||||
Checkin.Crashes.CONTENT_URI,
|
||||
new String[] { Checkin.Crashes._ID, Checkin.Crashes.DATA },
|
||||
null, null, null);
|
||||
|
||||
if (cursor != null) {
|
||||
startManagingCursor(cursor);
|
||||
|
||||
setListAdapter(new CursorAdapter(this, cursor, true) {
|
||||
public View newView(Context context, Cursor c, ViewGroup v) {
|
||||
return new CrashListItem(context);
|
||||
}
|
||||
|
||||
public void bindView(View view, Context c, Cursor cursor) {
|
||||
CrashListItem item = (CrashListItem) view;
|
||||
try {
|
||||
String data = cursor.getString(1);
|
||||
CrashData crash = new CrashData(
|
||||
new DataInputStream(
|
||||
new ByteArrayInputStream(
|
||||
Base64.decodeBase64(data.getBytes()))));
|
||||
|
||||
ThrowableData exc = crash.getThrowableData();
|
||||
item.setText(exc.getType() + ": " + exc.getMessage());
|
||||
item.setCrashData(crash);
|
||||
} catch (IOException e) {
|
||||
item.setText("Invalid crash: " + e);
|
||||
Log.e(TAG, "Invalid crash", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// No database, no exceptions, empty list.
|
||||
setListAdapter(new BaseAdapter() {
|
||||
public int getCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Object getItem(int position) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public View getView(int position, View convertView,
|
||||
ViewGroup parent) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static final int UPLOAD_ID = Menu.FIRST;
|
||||
private static final int CLEAR_ID = Menu.FIRST + 1;
|
||||
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
|
||||
menu.add(0, UPLOAD_ID, 0, R.string.menu_upload_exceptions);
|
||||
menu.add(0, CLEAR_ID, 0, R.string.menu_clear_exceptions);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle all of the possible menu actions.
|
||||
switch (item.getItemId()) {
|
||||
case UPLOAD_ID:
|
||||
sendBroadcast(new Intent(Checkin.TriggerIntent.ACTION));
|
||||
break;
|
||||
case CLEAR_ID:
|
||||
getContentResolver().delete(
|
||||
Checkin.Crashes.CONTENT_URI, null, null);
|
||||
break;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
static class CrashListItem extends TextView {
|
||||
CrashData crashData = null;
|
||||
|
||||
public CrashListItem(Context context) {
|
||||
super(context);
|
||||
setTextSize(10);
|
||||
setTypeface(Typeface.MONOSPACE);
|
||||
}
|
||||
|
||||
public CrashData getCrashData() {
|
||||
return crashData;
|
||||
}
|
||||
|
||||
public void setCrashData(CrashData crashData) {
|
||||
this.crashData = crashData;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View view, int pos, long id) {
|
||||
// TODO: Use a generic VIEW action on the crash's content URI.
|
||||
CrashData crash = ((CrashListItem) view).getCrashData();
|
||||
if (crash != null) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(this, StacktraceViewer.class);
|
||||
intent.putExtra(
|
||||
CrashData.class.getName(),
|
||||
crash.getThrowableData().toString());
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
** Copyright 2007, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.development;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.os.Bundle;
|
||||
import android.server.data.CrashData;
|
||||
import android.server.data.ThrowableData;
|
||||
import android.server.data.StackTraceElementData;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
/**
|
||||
* Views a single stack trace.
|
||||
*/
|
||||
public class StacktraceViewer extends Activity {
|
||||
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
setContentView(R.layout.log_viewer);
|
||||
|
||||
TextView text = (TextView) findViewById(R.id.text);
|
||||
text.setTextSize(10);
|
||||
text.setHorizontallyScrolling(true);
|
||||
text.setTypeface(Typeface.MONOSPACE);
|
||||
text.setMovementMethod(ScrollingMovementMethod.getInstance());
|
||||
|
||||
String stacktrace = getIntent().getExtras().getString(
|
||||
CrashData.class.getName());
|
||||
|
||||
text.setText(stacktrace);
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,11 @@ import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Debug;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.server.data.CrashData;
|
||||
import android.view.IWindowManager;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -209,26 +209,18 @@ public class Monkey {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean appCrashed(String processName, int pid, String shortMsg, String longMsg,
|
||||
byte[] crashData) {
|
||||
public boolean appCrashed(String processName, int pid,
|
||||
String tag, String shortMsg, String longMsg,
|
||||
long timeMillis, String stackTrace) {
|
||||
System.err.println("// CRASH: " + processName + " (pid " + pid + ")");
|
||||
System.err.println("// Short Msg: " + shortMsg);
|
||||
System.err.println("// Long Msg: " + longMsg);
|
||||
if (crashData != null) {
|
||||
try {
|
||||
CrashData cd = new CrashData(new DataInputStream(new ByteArrayInputStream(
|
||||
crashData)));
|
||||
System.err.println("// Build Label: " + cd.getBuildData().getFingerprint());
|
||||
System.err.println("// Build Changelist: "
|
||||
+ cd.getBuildData().getIncrementalVersion());
|
||||
System.err.println("// Build Time: " + cd.getBuildData().getTime());
|
||||
System.err.println("// ID: " + cd.getId());
|
||||
System.err.println("// Tag: " + cd.getActivity());
|
||||
System.err.println(cd.getThrowableData().toString("// "));
|
||||
} catch (IOException e) {
|
||||
System.err.println("// BAD STACK CRAWL");
|
||||
}
|
||||
}
|
||||
System.err.println("// Build Label: " + Build.FINGERPRINT);
|
||||
System.err.println("// Build Changelist: " + Build.VERSION.INCREMENTAL);
|
||||
System.err.println("// Build Time: " + Build.TIME);
|
||||
System.err.println("// ID: "); // TODO: This was never set -- remove?
|
||||
System.err.println("// Tag: " + tag);
|
||||
System.err.println("// " + stackTrace.replace("\n", "\n// "));
|
||||
|
||||
if (!mIgnoreCrashes) {
|
||||
synchronized (Monkey.this) {
|
||||
|
||||
Reference in New Issue
Block a user