diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-09-26 16:39:23 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-09-26 16:39:23 -0700 |
commit | 039c68e75606e837cf021815a0210836724574ad (patch) | |
tree | c65d4f12f6401a113421e3d6b59601da3d7ea97d /cmds/pm | |
parent | 075a18d607c3aa8386b4d06aea22f4bfacbe447b (diff) | |
download | frameworks_base-039c68e75606e837cf021815a0210836724574ad.zip frameworks_base-039c68e75606e837cf021815a0210836724574ad.tar.gz frameworks_base-039c68e75606e837cf021815a0210836724574ad.tar.bz2 |
The touch screen is probably a feature.
Also extend the feature APIs a bit.
Change-Id: I99e932d7f4e61edb0e20f75c55e9831e4b59a14d
Diffstat (limited to 'cmds/pm')
-rw-r--r-- | cmds/pm/src/com/android/commands/pm/Pm.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index b877098..79eb310 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -18,6 +18,7 @@ package com.android.commands.pm; import android.content.ComponentName; import android.content.pm.ApplicationInfo; +import android.content.pm.FeatureInfo; import android.content.pm.IPackageDeleteObserver; import android.content.pm.IPackageInstallObserver; import android.content.pm.IPackageManager; @@ -137,6 +138,7 @@ public final class Pm { * pm list [package | packages] * pm list permission-groups * pm list permissions + * pm list features * pm list instrumentation */ private void runList() { @@ -152,6 +154,8 @@ public final class Pm { runListPermissionGroups(); } else if ("permissions".equals(type)) { runListPermissions(); + } else if ("features".equals(type)) { + runListFeatures(); } else if ("instrumentation".equals(type)) { runListInstrumentation(); } else { @@ -205,6 +209,44 @@ public final class Pm { } /** + * Lists all of the features supported by the current device. + * + * pm list features + */ + private void runListFeatures() { + try { + List<FeatureInfo> list = new ArrayList<FeatureInfo>(); + FeatureInfo[] rawList = mPm.getSystemAvailableFeatures(); + for (int i=0; i<rawList.length; i++) { + list.add(rawList[i]); + } + + + // Sort by name + Collections.sort(list, new Comparator<FeatureInfo>() { + public int compare(FeatureInfo o1, FeatureInfo o2) { + if (o1.name == o2.name) return 0; + if (o1.name == null) return -1; + if (o2.name == null) return 1; + return o1.name.compareTo(o2.name); + } + }); + + int count = (list != null) ? list.size() : 0; + for (int p = 0; p < count; p++) { + FeatureInfo fi = list.get(p); + System.out.print("feature:"); + if (fi.name != null) System.out.println(fi.name); + else System.out.println("reqGlEsVersion=0x" + + Integer.toHexString(fi.reqGlEsVersion)); + } + } catch (RemoteException e) { + System.err.println(e.toString()); + System.err.println(PM_NOT_RUNNING_ERR); + } + } + + /** * Lists all of the installed instrumentation, or all for a given package * * pm list instrumentation [package] [-f] @@ -778,6 +820,7 @@ public final class Pm { System.err.println(" pm list permission-groups"); System.err.println(" pm list permissions [-g] [-f] [-d] [-u] [GROUP]"); System.err.println(" pm list instrumentation [-f] [TARGET-PACKAGE]"); + System.err.println(" pm list features"); System.err.println(" pm path PACKAGE"); System.err.println(" pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] PATH"); System.err.println(" pm uninstall [-k] PACKAGE"); @@ -802,6 +845,8 @@ public final class Pm { System.err.println("or only those that target a specified package. Options:"); System.err.println(" -f: see their associated file."); System.err.println(""); + System.err.println("The list features command prints all features of the system."); + System.err.println(""); System.err.println("The path command prints the path to the .apk of a package."); System.err.println(""); System.err.println("The install command installs a package to the system. Options:"); |