Example #1
0
 /**
  * install according conditions
  *
  * <ul>
  *   <li>if system application or rooted, see {@link #installSilent(Context, String)}
  *   <li>else see {@link #installNormal(Context, String)}
  * </ul>
  *
  * @param context
  * @param filePath
  * @return
  */
 public static final int install(Context context, String filePath) {
   if (PackageUtils.isSystemApplication(context) || ShellUtils.checkRootPermission()) {
     return installSilent(context, filePath);
   }
   return installNormal(context, filePath) ? INSTALL_SUCCEEDED : INSTALL_FAILED_INVALID_URI;
 }
Example #2
0
 /**
  * uninstall according conditions
  *
  * <ul>
  *   <li>if system application or rooted, see {@link #uninstallSilent(Context, String)}
  *   <li>else see {@link #uninstallNormal(Context, String)}
  * </ul>
  *
  * @param context
  * @param packageName package name of app
  * @return whether package name is empty
  * @return
  */
 public static final int uninstall(Context context, String packageName) {
   if (PackageUtils.isSystemApplication(context) || ShellUtils.checkRootPermission()) {
     return uninstallSilent(context, packageName);
   }
   return uninstallNormal(context, packageName) ? DELETE_SUCCEEDED : DELETE_FAILED_INVALID_PACKAGE;
 }