public static boolean updateManifest(JSONObject data,boolean force){
  if (data == null)   return false;
  Manifest manifest=parseManifest(data);
  if (manifest == null)   return false;
  String manifestJson;
  try {
    manifestJson=data.toString(2);
  }
 catch (  JSONException e) {
    e.printStackTrace();
    return false;
  }
  if (force) {
    File manifestFile=getPatchManifestFile();
    try {
      PrintWriter pw=new PrintWriter(new FileOutputStream(manifestFile));
      pw.print(manifestJson);
      pw.flush();
      pw.close();
    }
 catch (    Exception e) {
      e.printStackTrace();
      return false;
    }
    for (    Bundle bundle : manifest.bundles) {
      Bundle preloadBundle=findBundle(bundle.getPackageName(),sPreloadBundles);
      if (preloadBundle != null) {
        preloadBundle.uriString=bundle.uriString;
        preloadBundle.uri=bundle.uri;
        preloadBundle.rules=bundle.rules;
      }
    }
  }
 else {
    for (    Bundle bundle : manifest.bundles) {
      Bundle preloadBundle=findBundle(bundle.getPackageName(),sPreloadBundles);
      if (preloadBundle == null) {
        if (sUpdatingBundles == null) {
          sUpdatingBundles=new ArrayList<Bundle>();
        }
        sUpdatingBundles.add(bundle);
      }
    }
    setCacheManifest(manifestJson);
  }
  return true;
}

public static boolean updateManifest ( JSONObject data , boolean force ) { if ( data == null ) return false ; Manifest manifest = parseManifest ( data ) ; if ( manifest == null ) return false ; String manifestJson ; try { manifestJson = data . toString ( 2 ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; return false ; } if ( force ) { File manifestFile = getPatchManifestFile ( ) ; try { PrintWriter pw = new PrintWriter ( new FileOutputStream ( manifestFile ) ) ; pw . print ( manifestJson ) ; pw . flush ( ) ; pw . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return false ; } for ( Bundle bundle : manifest . bundles ) { Bundle preloadBundle = findBundle ( bundle . getPackageName ( ) , sPreloadBundles ) ; if ( preloadBundle != null ) { preloadBundle . uriString = bundle . uriString ; preloadBundle . uri = bundle . uri ; preloadBundle . rules = bundle . rules ; } } } else { for ( Bundle bundle : manifest . bundles ) { Bundle preloadBundle = findBundle ( bundle . getPackageName ( ) , sPreloadBundles ) ; if ( preloadBundle == null ) { if ( sUpdatingBundles == null ) { sUpdatingBundles = new ArrayList < Bundle > ( ) ; } sUpdatingBundles . add ( bundle ) ; } } setCacheManifest ( manifestJson ) ; } return true ; }
update bundle . json and apply settings
