Loading api/current.xml +26 −0 Original line number Diff line number Diff line Loading @@ -41626,6 +41626,19 @@ <parameter name="appInfo" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="hasSystemFeature" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="name" type="java.lang.String"> </parameter> </method> <method name="isSafeMode" return="boolean" abstract="true" Loading Loading @@ -131377,6 +131390,19 @@ <parameter name="appInfo" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="hasSystemFeature" return="boolean" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="name" type="java.lang.String"> </parameter> </method> <method name="isSafeMode" return="boolean" abstract="false" cmds/pm/src/com/android/commands/pm/Pm.java +45 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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() { Loading @@ -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 { Loading Loading @@ -204,6 +208,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 * Loading Loading @@ -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"); Loading @@ -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:"); Loading core/java/android/app/ApplicationContext.java +9 −0 Original line number Diff line number Diff line Loading @@ -1685,6 +1685,15 @@ class ApplicationContext extends Context { } } @Override public boolean hasSystemFeature(String name) { try { return mPM.hasSystemFeature(name); } catch (RemoteException e) { throw new RuntimeException("Package manager has died", e); } } @Override public int checkPermission(String permName, String pkgName) { try { Loading core/java/android/content/pm/IPackageManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,8 @@ interface IPackageManager { */ FeatureInfo[] getSystemAvailableFeatures(); boolean hasSystemFeature(String name); void enterSafeMode(); boolean isSafeMode(); void systemReady(); Loading core/java/android/content/pm/PackageManager.java +9 −1 Original line number Diff line number Diff line Loading @@ -995,10 +995,18 @@ public abstract class PackageManager { * * @return An array of FeatureInfo classes describing the features * that are available on the system, or null if there are none(!!). * */ public abstract FeatureInfo[] getSystemAvailableFeatures(); /** * Check whether the given feature name is one of the available * features as returned by {@link #getSystemAvailableFeatures()}. * * @return Returns true if the devices supports the feature, else * false. */ public abstract boolean hasSystemFeature(String name); /** * Determine the best action to perform for a given Intent. This is how * {@link Intent#resolveActivity} finds an activity if a class has not Loading Loading
api/current.xml +26 −0 Original line number Diff line number Diff line Loading @@ -41626,6 +41626,19 @@ <parameter name="appInfo" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="hasSystemFeature" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="name" type="java.lang.String"> </parameter> </method> <method name="isSafeMode" return="boolean" abstract="true" Loading Loading @@ -131377,6 +131390,19 @@ <parameter name="appInfo" type="android.content.pm.ApplicationInfo"> </parameter> </method> <method name="hasSystemFeature" return="boolean" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="name" type="java.lang.String"> </parameter> </method> <method name="isSafeMode" return="boolean" abstract="false"
cmds/pm/src/com/android/commands/pm/Pm.java +45 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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() { Loading @@ -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 { Loading Loading @@ -204,6 +208,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 * Loading Loading @@ -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"); Loading @@ -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:"); Loading
core/java/android/app/ApplicationContext.java +9 −0 Original line number Diff line number Diff line Loading @@ -1685,6 +1685,15 @@ class ApplicationContext extends Context { } } @Override public boolean hasSystemFeature(String name) { try { return mPM.hasSystemFeature(name); } catch (RemoteException e) { throw new RuntimeException("Package manager has died", e); } } @Override public int checkPermission(String permName, String pkgName) { try { Loading
core/java/android/content/pm/IPackageManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,8 @@ interface IPackageManager { */ FeatureInfo[] getSystemAvailableFeatures(); boolean hasSystemFeature(String name); void enterSafeMode(); boolean isSafeMode(); void systemReady(); Loading
core/java/android/content/pm/PackageManager.java +9 −1 Original line number Diff line number Diff line Loading @@ -995,10 +995,18 @@ public abstract class PackageManager { * * @return An array of FeatureInfo classes describing the features * that are available on the system, or null if there are none(!!). * */ public abstract FeatureInfo[] getSystemAvailableFeatures(); /** * Check whether the given feature name is one of the available * features as returned by {@link #getSystemAvailableFeatures()}. * * @return Returns true if the devices supports the feature, else * false. */ public abstract boolean hasSystemFeature(String name); /** * Determine the best action to perform for a given Intent. This is how * {@link Intent#resolveActivity} finds an activity if a class has not Loading