Added: Add functions to PackageUtils to get base APK path of package

This commit is contained in:
agnostic-apollo
2022-06-11 14:12:58 +05:00
parent 1788013c80
commit 790481b802

View File

@@ -375,6 +375,28 @@ public class PackageUtils {
/**
* Get the base apk path for the package associated with the {@code context}.
*
* @param context The {@link Context} for the package.
* @return Returns the base apk path.
*/
public static String getBaseAPKPathForPackage(@NonNull final Context context) {
return getBaseAPKPathForPackage(context.getApplicationInfo());
}
/**
* Get the base apk path for the package associated with the {@code applicationInfo}.
*
* @param applicationInfo The {@link ApplicationInfo} for the package.
* @return Returns the base apk path.
*/
public static String getBaseAPKPathForPackage(@NonNull final ApplicationInfo applicationInfo) {
return applicationInfo.publicSourceDir;
}
/**
* Check if the app associated with the {@code context} has {@link ApplicationInfo#FLAG_DEBUGGABLE}
* set.