public class PackageHelper extends Object
Modifier and Type | Field and Description |
---|---|
static int |
APP_INSTALL_AUTO |
static int |
APP_INSTALL_EXTERNAL |
static int |
APP_INSTALL_INTERNAL |
static int |
RECOMMEND_FAILED_ALREADY_EXISTS |
static int |
RECOMMEND_FAILED_INSUFFICIENT_STORAGE |
static int |
RECOMMEND_FAILED_INVALID_APK |
static int |
RECOMMEND_FAILED_INVALID_LOCATION |
static int |
RECOMMEND_FAILED_INVALID_URI |
static int |
RECOMMEND_FAILED_VERSION_DOWNGRADE |
static int |
RECOMMEND_INSTALL_EPHEMERAL |
static int |
RECOMMEND_INSTALL_EXTERNAL |
static int |
RECOMMEND_INSTALL_INTERNAL |
static int |
RECOMMEND_MEDIA_UNAVAILABLE |
Constructor and Description |
---|
PackageHelper() |
Modifier and Type | Method and Description |
---|---|
static long |
calculateInstalledSize(PackageParser.PackageLite pkg,
boolean isForwardLocked,
String abiOverride) |
static long |
calculateInstalledSize(PackageParser.PackageLite pkg,
NativeLibraryHelper.Handle handle,
boolean isForwardLocked,
String abiOverride) |
static String |
createSdDir(long sizeBytes,
String cid,
String sdEncKey,
int uid,
boolean isExternal) |
static boolean |
destroySdDir(String cid) |
static long |
extractPublicFiles(File apkFile,
File publicZipFile)
Extract public files for the single given APK.
|
static boolean |
finalizeSdDir(String cid) |
static boolean |
fitsOnExternal(Context context,
long sizeBytes) |
static boolean |
fitsOnInternal(Context context,
long sizeBytes) |
static boolean |
fixSdPermissions(String cid,
int gid,
String filename) |
static IMountService |
getMountService() |
static String |
getSdDir(String cid) |
static String |
getSdFilesystem(String cid) |
static String[] |
getSecureContainerList() |
static boolean |
isContainerMounted(String cid) |
static String |
mountSdDir(String cid,
String key,
int ownerUid) |
static String |
mountSdDir(String cid,
String key,
int ownerUid,
boolean readOnly) |
static boolean |
renameSdDir(String oldId,
String newId) |
static String |
replaceEnd(String str,
String before,
String after) |
static boolean |
resizeSdDir(long sizeBytes,
String cid,
String sdEncKey) |
static int |
resolveInstallLocation(Context context,
String packageName,
int installLocation,
long sizeBytes,
int installFlags)
Given a requested
PackageInfo.installLocation and calculated
install size, pick the actual location to install the app. |
static String |
resolveInstallVolume(Context context,
String packageName,
int installLocation,
long sizeBytes)
Given a requested
PackageInfo.installLocation and calculated
install size, pick the actual volume to install the app. |
static boolean |
unMountSdDir(String cid) |
public static final int RECOMMEND_INSTALL_INTERNAL
public static final int RECOMMEND_INSTALL_EXTERNAL
public static final int RECOMMEND_INSTALL_EPHEMERAL
public static final int RECOMMEND_FAILED_INSUFFICIENT_STORAGE
public static final int RECOMMEND_FAILED_INVALID_APK
public static final int RECOMMEND_FAILED_INVALID_LOCATION
public static final int RECOMMEND_FAILED_ALREADY_EXISTS
public static final int RECOMMEND_MEDIA_UNAVAILABLE
public static final int RECOMMEND_FAILED_INVALID_URI
public static final int RECOMMEND_FAILED_VERSION_DOWNGRADE
public static final int APP_INSTALL_AUTO
public static final int APP_INSTALL_INTERNAL
public static final int APP_INSTALL_EXTERNAL
public static IMountService getMountService() throws RemoteException
RemoteException
public static String createSdDir(long sizeBytes, String cid, String sdEncKey, int uid, boolean isExternal)
public static boolean unMountSdDir(String cid)
public static boolean finalizeSdDir(String cid)
public static boolean destroySdDir(String cid)
public static String[] getSecureContainerList()
public static boolean isContainerMounted(String cid)
public static long extractPublicFiles(File apkFile, File publicZipFile) throws IOException
IOException
public static String resolveInstallVolume(Context context, String packageName, int installLocation, long sizeBytes) throws IOException
PackageInfo.installLocation
and calculated
install size, pick the actual volume to install the app. Only considers
internal and private volumes, and prefers to keep an existing package on
its current volume.VolumeInfo.fsUuid
to install onto, or null
for internal storage.IOException
public static boolean fitsOnInternal(Context context, long sizeBytes)
public static boolean fitsOnExternal(Context context, long sizeBytes)
public static int resolveInstallLocation(Context context, String packageName, int installLocation, long sizeBytes, int installFlags)
PackageInfo.installLocation
and calculated
install size, pick the actual location to install the app.public static long calculateInstalledSize(PackageParser.PackageLite pkg, boolean isForwardLocked, String abiOverride) throws IOException
IOException
public static long calculateInstalledSize(PackageParser.PackageLite pkg, NativeLibraryHelper.Handle handle, boolean isForwardLocked, String abiOverride) throws IOException
IOException