Added: Add uid to app info

This commit is contained in:
agnostic-apollo 2021-10-18 15:34:23 +05:00
parent a987246bd8
commit 2c6d009657
2 changed files with 23 additions and 0 deletions

View File

@ -204,6 +204,28 @@ public class PackageUtils {
/**
* Get the uid for the package associated with the {@code context}.
*
* @param context The {@link Context} for the package.
* @return Returns the uid.
*/
public static int getUidForPackage(@NonNull final Context context) {
return getUidForPackage(context.getApplicationInfo());
}
/**
* Get the uid for the package associated with the {@code applicationInfo}.
*
* @param applicationInfo The {@link ApplicationInfo} for the package.
* @return Returns the uid.
*/
public static int getUidForPackage(@NonNull final ApplicationInfo applicationInfo) {
return applicationInfo.uid;
}
/**
* Get the {@code targetSdkVersion} for the package associated with the {@code context}.
*

View File

@ -74,6 +74,7 @@ public class AndroidUtils {
AndroidUtils.appendPropertyToMarkdown(markdownString,"PACKAGE_NAME", PackageUtils.getPackageNameForPackage(applicationInfo));
AndroidUtils.appendPropertyToMarkdown(markdownString,"VERSION_NAME", PackageUtils.getVersionNameForPackage(context, packageName));
AndroidUtils.appendPropertyToMarkdown(markdownString,"VERSION_CODE", PackageUtils.getVersionCodeForPackage(context, packageName));
AndroidUtils.appendPropertyToMarkdown(markdownString,"UID", PackageUtils.getUidForPackage(applicationInfo));
AndroidUtils.appendPropertyToMarkdown(markdownString,"TARGET_SDK", PackageUtils.getTargetSDKForPackage(applicationInfo));
AndroidUtils.appendPropertyToMarkdown(markdownString,"IS_DEBUGGABLE_BUILD", PackageUtils.isAppForPackageADebuggableBuild(applicationInfo));