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

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

Merge "Upstream getApplicationLabel()." into oc-dr1-dev

am: 7049137d

Change-Id: I48e3995679750566d551edc3f63fa98a55bbc75d
parents dd807e6b 7049137d
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -107,4 +107,20 @@ public class AppUtils {
        return false;
        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;
    }

}
}