From 569c7e25cbf98bde00546c57e30b1cd6c318544e Mon Sep 17 00:00:00 2001 From: jeffreyhuang Date: Fri, 22 Sep 2017 14:44:57 -0700 Subject: [PATCH] Add new methods to PkgMgrWrapper for testing - add setApplicationInfo - add getApplicationLabel Bug: 34203528 Test: make RunSettingsRoboTests -j40 Change-Id: I6009dfa5df9a47c939ae113eec85a98811887bf7 --- .../wrapper/PackageManagerWrapper.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/wrapper/PackageManagerWrapper.java b/packages/SettingsLib/src/com/android/settingslib/wrapper/PackageManagerWrapper.java index f12148083cbde..4ca5beff8eb25 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wrapper/PackageManagerWrapper.java +++ b/packages/SettingsLib/src/com/android/settingslib/wrapper/PackageManagerWrapper.java @@ -139,11 +139,11 @@ public class PackageManagerWrapper { /** * Gets information about a particular package from the package manager. + * * @param packageName The name of the package we would like information about. - * @param i additional options flags. see javadoc for - * {@link PackageManager#getPackageInfo(String, int)} + * @param i additional options flags. see javadoc for + * {@link PackageManager#getPackageInfo(String, int)} * @return The PackageInfo for the requested package - * @throws NameNotFoundException */ public PackageInfo getPackageInfo(String packageName, int i) throws NameNotFoundException { return mPm.getPackageInfo(packageName, i); @@ -151,6 +151,7 @@ public class PackageManagerWrapper { /** * Retrieves the icon associated with this particular set of ApplicationInfo + * * @param info The ApplicationInfo to retrieve the icon for * @return The icon as a drawable. */ @@ -161,6 +162,7 @@ public class PackageManagerWrapper { /** * Retrieves the label associated with the particular set of ApplicationInfo + * * @param app The ApplicationInfo to retrieve the label for * @return the label as a CharSequence */ @@ -211,4 +213,20 @@ public class PackageManagerWrapper { public int getApplicationEnabledSetting(String packageName) { return mPm.getApplicationEnabledSetting(packageName); } + + /** + * Calls {@code PackageManager.getApplicationInfo} + */ + public ApplicationInfo getApplicationInfo(String packageName, int flags) + throws NameNotFoundException { + return mPm.getApplicationInfo(packageName, flags); + } + + /** + * Calls {@code PackageManager.getApplicationLabel} + */ + public CharSequence getApplicationLabel(ApplicationInfo info) { + return mPm.getApplicationLabel(info); + } } +