Java Code Examples for android.content.pm.PackageInfo#INSTALL_LOCATION_UNSPECIFIED

The following examples show how to use android.content.pm.PackageInfo#INSTALL_LOCATION_UNSPECIFIED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
private static boolean isPackageCandidateVolume(ApplicationInfo app, VolumeInfo vol) {
    // Private internal is always an option
    if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())) {
        return true;
    }

    // System apps and apps demanding internal storage can't be moved
    // anywhere else
    if (app.isSystemApp()
            || app.installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY
            || app.installLocation == PackageInfo.INSTALL_LOCATION_UNSPECIFIED) {
        return false;
    }

    // Gotta be able to write there
    if (!vol.isMountedWritable()) {
        return false;
    }

    // Moving into an ASEC on public primary is only option internal
    if (vol.isPrimaryPhysical()) {
        return app.isInternal();
    }

    // Otherwise we can move to any private volume
    return (vol.getType() == VolumeInfo.TYPE_PRIVATE);
}
 
Example 2
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
private boolean isPackageCandidateVolume(
        ContextImpl context, ApplicationInfo app, VolumeInfo vol) {
    final boolean forceAllowOnExternal = Settings.Global.getInt(
            context.getContentResolver(), Settings.Global.FORCE_ALLOW_ON_EXTERNAL, 0) != 0;
    // Private internal is always an option
    if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())) {
        return true;
    }

    // System apps and apps demanding internal storage can't be moved
    // anywhere else
    if (app.isSystemApp()) {
        return false;
    }
    if (!forceAllowOnExternal
            && (app.installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY
                    || app.installLocation == PackageInfo.INSTALL_LOCATION_UNSPECIFIED)) {
        return false;
    }

    // Gotta be able to write there
    if (!vol.isMountedWritable()) {
        return false;
    }

    // Moving into an ASEC on public primary is only option internal
    if (vol.isPrimaryPhysical()) {
        return app.isInternal();
    }

    // Some apps can't be moved. (e.g. device admins)
    try {
        if (mPM.isPackageDeviceAdminOnAnyUser(app.packageName)) {
            return false;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    // Otherwise we can move to any private volume
    return (vol.getType() == VolumeInfo.TYPE_PRIVATE);
}
 
Example 3
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
private boolean isPackageCandidateVolume(
        ContextImpl context, ApplicationInfo app, VolumeInfo vol, IPackageManager pm) {
    final boolean forceAllowOnExternal = isForceAllowOnExternal(context);

    if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())) {
        return app.isSystemApp() || isAllow3rdPartyOnInternal(context);
    }

    // System apps and apps demanding internal storage can't be moved
    // anywhere else
    if (app.isSystemApp()) {
        return false;
    }
    if (!forceAllowOnExternal
            && (app.installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY
                    || app.installLocation == PackageInfo.INSTALL_LOCATION_UNSPECIFIED)) {
        return false;
    }

    // Gotta be able to write there
    if (!vol.isMountedWritable()) {
        return false;
    }

    // Moving into an ASEC on public primary is only option internal
    if (vol.isPrimaryPhysical()) {
        return app.isInternal();
    }

    // Some apps can't be moved. (e.g. device admins)
    try {
        if (pm.isPackageDeviceAdminOnAnyUser(app.packageName)) {
            return false;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    // Otherwise we can move to any private volume
    return (vol.getType() == VolumeInfo.TYPE_PRIVATE);
}
 
Example 4
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
private boolean isPackageCandidateVolume(
        ContextImpl context, ApplicationInfo app, VolumeInfo vol, IPackageManager pm) {
    final boolean forceAllowOnExternal = isForceAllowOnExternal(context);

    if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())) {
        return app.isSystemApp() || isAllow3rdPartyOnInternal(context);
    }

    // System apps and apps demanding internal storage can't be moved
    // anywhere else
    if (app.isSystemApp()) {
        return false;
    }
    if (!forceAllowOnExternal
            && (app.installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY
                    || app.installLocation == PackageInfo.INSTALL_LOCATION_UNSPECIFIED)) {
        return false;
    }

    // Gotta be able to write there
    if (!vol.isMountedWritable()) {
        return false;
    }

    // Moving into an ASEC on public primary is only option internal
    if (vol.isPrimaryPhysical()) {
        return app.isInternal();
    }

    // Some apps can't be moved. (e.g. device admins)
    try {
        if (pm.isPackageDeviceAdminOnAnyUser(app.packageName)) {
            return false;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    // Otherwise we can move to any private volume
    return (vol.getType() == VolumeInfo.TYPE_PRIVATE);
}
 
Example 5
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
private boolean isPackageCandidateVolume(
        ContextImpl context, ApplicationInfo app, VolumeInfo vol, IPackageManager pm) {
    final boolean forceAllowOnExternal = isForceAllowOnExternal(context);

    if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())) {
        return app.isSystemApp() || isAllow3rdPartyOnInternal(context);
    }

    // System apps and apps demanding internal storage can't be moved
    // anywhere else
    if (app.isSystemApp()) {
        return false;
    }
    if (!forceAllowOnExternal
            && (app.installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY
                    || app.installLocation == PackageInfo.INSTALL_LOCATION_UNSPECIFIED)) {
        return false;
    }

    // Gotta be able to write there
    if (!vol.isMountedWritable()) {
        return false;
    }

    // Moving into an ASEC on public primary is only option internal
    if (vol.isPrimaryPhysical()) {
        return app.isInternal();
    }

    // Some apps can't be moved. (e.g. device admins)
    try {
        if (pm.isPackageDeviceAdminOnAnyUser(app.packageName)) {
            return false;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    // Otherwise we can move to any private volume
    return (vol.getType() == VolumeInfo.TYPE_PRIVATE);
}
 
Example 6
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
private boolean isPackageCandidateVolume(
        ContextImpl context, ApplicationInfo app, VolumeInfo vol, IPackageManager pm) {
    final boolean forceAllowOnExternal = isForceAllowOnExternal(context);

    if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())) {
        return app.isSystemApp() || isAllow3rdPartyOnInternal(context);
    }

    // System apps and apps demanding internal storage can't be moved
    // anywhere else
    if (app.isSystemApp()) {
        return false;
    }
    if (!forceAllowOnExternal
            && (app.installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY
                    || app.installLocation == PackageInfo.INSTALL_LOCATION_UNSPECIFIED)) {
        return false;
    }

    // Gotta be able to write there
    if (!vol.isMountedWritable()) {
        return false;
    }

    // Moving into an ASEC on public primary is only option internal
    if (vol.isPrimaryPhysical()) {
        return app.isInternal();
    }

    // Some apps can't be moved. (e.g. device admins)
    try {
        if (pm.isPackageDeviceAdminOnAnyUser(app.packageName)) {
            return false;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    // Otherwise we can move to any private volume
    return (vol.getType() == VolumeInfo.TYPE_PRIVATE);
}
 
Example 7
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
private boolean isPackageCandidateVolume(
        ContextImpl context, ApplicationInfo app, VolumeInfo vol, IPackageManager pm) {
    final boolean forceAllowOnExternal = isForceAllowOnExternal(context);

    if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())) {
        return app.isSystemApp() || isAllow3rdPartyOnInternal(context);
    }

    // System apps and apps demanding internal storage can't be moved
    // anywhere else
    if (app.isSystemApp()) {
        return false;
    }
    if (!forceAllowOnExternal
            && (app.installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY
                    || app.installLocation == PackageInfo.INSTALL_LOCATION_UNSPECIFIED)) {
        return false;
    }

    // Gotta be able to write there
    if (!vol.isMountedWritable()) {
        return false;
    }

    // Moving into an ASEC on public primary is only option internal
    if (vol.isPrimaryPhysical()) {
        return app.isInternal();
    }

    // Some apps can't be moved. (e.g. device admins)
    try {
        if (pm.isPackageDeviceAdminOnAnyUser(app.packageName)) {
            return false;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    // Otherwise we can move to any private volume
    return (vol.getType() == VolumeInfo.TYPE_PRIVATE);
}
 
Example 8
Source File: ApplicationPackageManager.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
private boolean isPackageCandidateVolume(
        ContextImpl context, ApplicationInfo app, VolumeInfo vol) {
    final boolean forceAllowOnExternal = Settings.Global.getInt(
            context.getContentResolver(), Settings.Global.FORCE_ALLOW_ON_EXTERNAL, 0) != 0;
    // Private internal is always an option
    if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())) {
        return true;
    }

    // System apps and apps demanding internal storage can't be moved
    // anywhere else
    if (app.isSystemApp()) {
        return false;
    }
    if (!forceAllowOnExternal
            && (app.installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY
                    || app.installLocation == PackageInfo.INSTALL_LOCATION_UNSPECIFIED)) {
        return false;
    }

    // Gotta be able to write there
    if (!vol.isMountedWritable()) {
        return false;
    }

    // Moving into an ASEC on public primary is only option internal
    if (vol.isPrimaryPhysical()) {
        return app.isInternal();
    }

    // Some apps can't be moved. (e.g. device admins)
    try {
        if (mPM.isPackageDeviceAdminOnAnyUser(app.packageName)) {
            return false;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    // Otherwise we can move to any private volume
    return (vol.getType() == VolumeInfo.TYPE_PRIVATE);
}
 
Example 9
Source File: ApplicationPackageManager.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private boolean isPackageCandidateVolume(
        ContextImpl context, ApplicationInfo app, VolumeInfo vol, IPackageManager pm) {
    final boolean forceAllowOnExternal = isForceAllowOnExternal(context);

    if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())) {
        return app.isSystemApp() || isAllow3rdPartyOnInternal(context);
    }

    // System apps and apps demanding internal storage can't be moved
    // anywhere else
    if (app.isSystemApp()) {
        return false;
    }
    if (!forceAllowOnExternal
            && (app.installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY
                    || app.installLocation == PackageInfo.INSTALL_LOCATION_UNSPECIFIED)) {
        return false;
    }

    // Gotta be able to write there
    if (!vol.isMountedWritable()) {
        return false;
    }

    // Moving into an ASEC on public primary is only option internal
    if (vol.isPrimaryPhysical()) {
        return app.isInternal();
    }

    // Some apps can't be moved. (e.g. device admins)
    try {
        if (pm.isPackageDeviceAdminOnAnyUser(app.packageName)) {
            return false;
        }
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }

    // Otherwise we can move to any private volume
    return (vol.getType() == VolumeInfo.TYPE_PRIVATE);
}