shadows/framework/src/main/java/org/robolectric/shadows/ShadowPackageManager.java
public void doPendingUninstallCallbacks() {
    boolean hasDeletePackagesPermission = false;
    String[] requestedPermissions =
        packageInfos.get(RuntimeEnvironment.application.getPackageName()).requestedPermissions;
    if (requestedPermissions != null) {
      for (String permission : requestedPermissions) {
        if (Manifest.permission.DELETE_PACKAGES.equals(permission)) {
          hasDeletePackagesPermission = true;
          break;
        }
      }
    }

    for (String packageName : pendingDeleteCallbacks.keySet()) {
      int resultCode = PackageManager.DELETE_FAILED_INTERNAL_ERROR;

      PackageInfo removed = packageInfos.get(packageName);
      if (hasDeletePackagesPermission && removed != null) {
        deletePackage(packageName);
        resultCode = PackageManager.DELETE_SUCCEEDED;
      }

      try {
        pendingDeleteCallbacks.get(packageName).packageDeleted(packageName, resultCode);
      } catch (RemoteException e) {
        throw new RuntimeException(e);
      }
    }
    pendingDeleteCallbacks.clear();
  }
public void doPendingUninstallCallbacks() {
    boolean hasDeletePackagesPermission = false;
    String[] requestedPermissions =
        packageInfos.get(RuntimeEnvironment.application.getPackageName()).requestedPermissions;
    if (requestedPermissions != null) {
      for (String permission : requestedPermissions) {
        if (Manifest.permission.DELETE_PACKAGES.equals(permission)) {
          hasDeletePackagesPermission = true;
          break;
        }
      }
    }

    for (String packageName : pendingDeleteCallbacks.keySet()) {
      int resultCode = PackageManager.DELETE_FAILED_INTERNAL_ERROR;

      PackageInfo removed = packageInfos.get(packageName);
      if (hasDeletePackagesPermission && removed != null) {
        deletePackage(packageName);
        resultCode = PackageManager.DELETE_SUCCEEDED;
      }

      try {
        pendingDeleteCallbacks.get(packageName).packageDeleted(packageName, resultCode);
      } catch (RemoteException e) {
        throw new RuntimeException(e);
      }
    }
    pendingDeleteCallbacks.clear();
  }
public void doPendingUninstallCallbacks ( ) { boolean hasDeletePackagesPermission = false ; String [ ] requestedPermissions = packageInfos . get ( RuntimeEnvironment . application . getPackageName ( ) ) . requestedPermissions ; if ( requestedPermissions != null ) { for ( String permission : requestedPermissions ) { if ( Manifest . permission . DELETE_PACKAGES . equals ( permission ) ) { hasDeletePackagesPermission = true ; break ; } } } for ( String packageName : pendingDeleteCallbacks . keySet ( ) ) { int resultCode = PackageManager . DELETE_FAILED_INTERNAL_ERROR ; PackageInfo removed = packageInfos . get ( packageName ) ; if ( hasDeletePackagesPermission && removed != null ) { deletePackage ( packageName ) ; resultCode = PackageManager . DELETE_SUCCEEDED ; } try { pendingDeleteCallbacks . get ( packageName ) . packageDeleted ( packageName , resultCode ) ; } catch ( RemoteException e ) { throw new RuntimeException ( e ) ; } } pendingDeleteCallbacks . clear ( ) ; }
Runs the callbacks pending from calls to {@link PackageManager#deletePackage(String,
IPackageDeleteObserver, int)}
Runs the callbacks pending from calls to {