}
}
private void printHostedFragments(String[] ids, PrintStream out, PrintStream err)
{
PackageAdmin pa = getPackageAdmin();
if (pa == null)
{
out.println("PackageAdmin service is unavailable.");
}
else
{
Bundle[] bundles = null;
if ((ids == null) || (ids.length == 0))
{
bundles = m_context.getBundles();
}
else
{
bundles = new Bundle[ids.length];
for (int idIdx = 0; idIdx < ids.length; idIdx++)
{
try
{
long l = Long.parseLong(ids[idIdx]);
Bundle b = m_context.getBundle(l);
if (b == null)
{
err.println("Bundle ID " + ids[idIdx] + " is invalid.");
}
bundles[idIdx] = b;
}
catch (NumberFormatException ex)
{
err.println("Unable to parse id '" + ids[idIdx] + "'.");
}
}
}
for (int bundleIdx = 0; bundleIdx < bundles.length; bundleIdx++)
{
// Print a separator for some whitespace.
if (bundleIdx > 0)
{
out.println("");
}
try
{
if ((bundles[bundleIdx] != null) && !isFragment(bundles[bundleIdx]))
{
String title = bundles[bundleIdx] + " hosts:";
out.println(title);
out.println(Util.getUnderlineString(title));
Bundle[] fragments = pa.getFragments(bundles[bundleIdx]);
for (int fragIdx = 0;
(fragments != null) && (fragIdx < fragments.length);
fragIdx++)
{
out.println(fragments[fragIdx]);