Skip to content

Commit

Permalink
fix: follow android reco
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Mar 19, 2024
1 parent 638d8d4 commit 575f908
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class InternalUtils {

public static String getPackageName(PackageManager pm, String packageName) {
try {
PackageInfo pInfo = getPackageInfoInternal(pm, packageName, 0);
PackageInfo pInfo = getPackageInfoInternal(pm, packageName);
return (pInfo != null) ? pInfo.packageName : null;
} catch (PackageManager.NameNotFoundException e) {
// Exception is handled internally, and null is returned to indicate the package name could not be retrieved
Expand All @@ -18,16 +18,15 @@ public static String getPackageName(PackageManager pm, String packageName) {

private static PackageInfo getPackageInfoInternal(
PackageManager pm,
String packageName,
long flags
String packageName
) throws PackageManager.NameNotFoundException {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
return pm.getPackageInfo(
packageName,
PackageManager.PackageInfoFlags.of(flags)
PackageManager.PackageInfoFlags.of(0)
);
} else {
return getPackageInfoLegacy(pm, packageName, (int) flags);
return getPackageInfoLegacy(pm, packageName, (int) (long) 0);
}
}

Expand Down

0 comments on commit 575f908

Please sign in to comment.