Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d9ce667 authored by Daniel Nishi's avatar Daniel Nishi Committed by android-build-merger
Browse files

Merge "Upstream getApplicationLabel()." into oc-dr1-dev am: 7049137d

am: d587b008

Change-Id: I75625816eba3a60c46bf27c6f7c6df7606e9faee
parents f54803bb d587b008
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -107,4 +107,20 @@ public class AppUtils {
        return false;
    }

    /** Returns the label for a given package. */
    public static CharSequence getApplicationLabel(
            PackageManager packageManager, String packageName) {
        try {
            final ApplicationInfo appInfo =
                    packageManager.getApplicationInfo(
                            packageName,
                            PackageManager.MATCH_DISABLED_COMPONENTS
                                    | PackageManager.MATCH_ANY_USER);
            return appInfo.loadLabel(packageManager);
        } catch (PackageManager.NameNotFoundException e) {
            Log.w(TAG, "Unable to find info for package: " + packageName);
        }
        return null;
    }

}