Improve DebuggableTest
Show all the APKs that are marked as debuggable rather than
just the first one that is caught.
Change-Id: I1c4adeaa826fc37c6d1e2945caa24db898aca8f7
diff --git a/tests/tests/permission/src/android/permission/cts/DebuggableTest.java b/tests/tests/permission/src/android/permission/cts/DebuggableTest.java
index fe4ed57..d77e13e 100644
--- a/tests/tests/permission/src/android/permission/cts/DebuggableTest.java
+++ b/tests/tests/permission/src/android/permission/cts/DebuggableTest.java
@@ -20,7 +20,9 @@
import android.content.pm.PackageManager;
import android.test.AndroidTestCase;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* Verify that pre-installed packages don't have the debuggable
@@ -30,13 +32,16 @@
public class DebuggableTest extends AndroidTestCase {
public void testNoDebuggable() {
+ Set<String> debuggableApps = new HashSet<String>();
List<ApplicationInfo> apps = getContext()
.getPackageManager()
.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (ApplicationInfo app : apps) {
String appName = app.packageName;
- assertTrue("Package " + appName + " is marked as debuggable.",
- (app.flags & ApplicationInfo.FLAG_DEBUGGABLE) == 0);
+ if ((app.flags & ApplicationInfo.FLAG_DEBUGGABLE) == ApplicationInfo.FLAG_DEBUGGABLE) {
+ debuggableApps.add(appName);
+ }
}
+ assertTrue("Packages marked debuggable: " + debuggableApps, debuggableApps.isEmpty());
}
}