use of android.app.ActivityManager.ProcessErrorStateInfo in project android_frameworks_base by ParanoidAndroid.
the class MemoryUsageTest method reportError.
private void reportError(String appName, String processName, Bundle results) {
ActivityManager am = (ActivityManager) getInstrumentation().getContext().getSystemService(Context.ACTIVITY_SERVICE);
List<ProcessErrorStateInfo> crashes = am.getProcessesInErrorState();
if (crashes != null) {
for (ProcessErrorStateInfo crash : crashes) {
if (!crash.processName.equals(processName))
continue;
Log.w(TAG, appName + " crashed: " + crash.shortMsg);
results.putString(mNameToResultKey.get(appName), crash.shortMsg);
return;
}
}
results.putString(mNameToResultKey.get(appName), "Crashed for unknown reason");
Log.w(TAG, appName + " not found in process list, most likely it is crashed");
}
use of android.app.ActivityManager.ProcessErrorStateInfo in project android_frameworks_base by ParanoidAndroid.
the class ProcessErrorsTest method reportListContents.
/**
* This helper function will dump the actual error reports.
*
* @param errList The error report containing one or more error records.
* @return Returns a string containing all of the errors.
*/
private static String reportListContents(Collection<ProcessErrorStateInfo> errList) {
if (errList == null)
return null;
StringBuilder builder = new StringBuilder();
Iterator<ProcessErrorStateInfo> iter = errList.iterator();
while (iter.hasNext()) {
ProcessErrorStateInfo entry = iter.next();
String condition;
switch(entry.condition) {
case ActivityManager.ProcessErrorStateInfo.CRASHED:
condition = "a CRASH";
break;
case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING:
condition = "an ANR";
break;
default:
condition = "an unknown error";
break;
}
builder.append(String.format("Process %s encountered %s (%s)", entry.processName, condition, entry.shortMsg));
if (entry.condition == ActivityManager.ProcessErrorStateInfo.CRASHED) {
builder.append(String.format(" with stack trace:\n%s\n", entry.stackTrace));
}
builder.append("\n");
}
return builder.toString();
}
use of android.app.ActivityManager.ProcessErrorStateInfo in project android_frameworks_base by ResurrectionRemix.
the class MemoryUsageTest method reportError.
private void reportError(String appName, String processName, Bundle results) {
ActivityManager am = (ActivityManager) getInstrumentation().getContext().getSystemService(Context.ACTIVITY_SERVICE);
List<ProcessErrorStateInfo> crashes = am.getProcessesInErrorState();
if (crashes != null) {
for (ProcessErrorStateInfo crash : crashes) {
if (!crash.processName.equals(processName))
continue;
Log.w(TAG, appName + " crashed: " + crash.shortMsg);
results.putString(mNameToResultKey.get(appName), crash.shortMsg);
return;
}
}
results.putString(mNameToResultKey.get(appName), "Crashed for unknown reason");
Log.w(TAG, appName + " not found in process list, most likely it is crashed");
}
use of android.app.ActivityManager.ProcessErrorStateInfo in project android_frameworks_base by ResurrectionRemix.
the class AppLaunch method reportError.
private void reportError(String appName, String processName) {
ActivityManager am = (ActivityManager) getInstrumentation().getContext().getSystemService(Context.ACTIVITY_SERVICE);
List<ProcessErrorStateInfo> crashes = am.getProcessesInErrorState();
if (crashes != null) {
for (ProcessErrorStateInfo crash : crashes) {
if (!crash.processName.equals(processName))
continue;
Log.w(TAG, appName + " crashed: " + crash.shortMsg);
mResult.putString(mNameToResultKey.get(appName), crash.shortMsg);
return;
}
}
mResult.putString(mNameToResultKey.get(appName), "Crashed for unknown reason");
Log.w(TAG, appName + " not found in process list, most likely it is crashed");
}
use of android.app.ActivityManager.ProcessErrorStateInfo in project android_frameworks_base by ResurrectionRemix.
the class AppCompatibility method testAppStability.
/**
* Actual test case that launches the package and throws an exception on the
* first error.
*
* @throws Exception
*/
public void testAppStability() throws Exception {
String packageName = mArgs.getString(PACKAGE_TO_LAUNCH);
if (packageName != null) {
Log.d(TAG, "Launching app " + packageName);
Intent intent = getLaunchIntentForPackage(packageName);
if (intent == null) {
Log.w(TAG, String.format("Skipping %s; no launch intent", packageName));
return;
}
ProcessErrorStateInfo err = launchActivity(packageName, intent);
// Make sure there are no errors when launching the application,
// otherwise raise an
// exception with the first error encountered.
assertNull(getStackTrace(err), err);
try {
assertTrue("App crashed after launch.", processStillUp(packageName));
} finally {
returnHome();
}
} else {
Log.d(TAG, "Missing argument, use " + PACKAGE_TO_LAUNCH + " to specify the package to launch");
}
}
Aggregations