Java Code Examples for android.content.pm.PackageInfo#INSTALL_LOCATION_INTERNAL_ONLY
The following examples show how to use
android.content.pm.PackageInfo#INSTALL_LOCATION_INTERNAL_ONLY .
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 |
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: TypeTranslators.java From under-the-hood with Apache License 2.0 | 5 votes |
public static String translatePMInstallLocation(int installLocationType) { switch (installLocationType) { case PackageInfo.INSTALL_LOCATION_AUTO: return "AUTO"; case PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY: return "INTERNAL_ONLY"; case PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL: return "PREFER_EXTERNAL"; case -1: return "UNSPECIFIED"; default: return "UNKNOWN (" + installLocationType + ")"; } }
Example 3
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
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 4
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
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 |
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 |
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 |
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 |
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 9
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
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 10
Source File: ApplicationPackageManager.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
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); }