Exemplo n.º 1
0
  private void flushBufferToDb() throws RepoUpdater.UpdateException {
    if (!hasBeenInitialized) {
      // This is where we will store all of the metadata before commiting at the
      // end of the process. This is due to the fact that we can't verify the cert
      // the index was signed with until we've finished reading it - and we don't
      // want to put stuff in the real database until we are sure it is from a
      // trusted source.
      TempAppProvider.Helper.init(context);
      TempApkProvider.Helper.init(context);
      hasBeenInitialized = true;
    }

    if (apksToSave.size() > 0 || appsToSave.size() > 0) {
      Log.d(
          TAG,
          "Flushing details of up to "
              + MAX_APP_BUFFER
              + " apps and their packages to the database.");
      flushAppsToDbInBatch();
      flushApksToDbInBatch();
      apksToSave.clear();
      appsToSave.clear();
    }
  }
Exemplo n.º 2
0
 public void commit(ContentValues repoDetailsToSave) throws RepoUpdater.UpdateException {
   flushBufferToDb();
   TempAppProvider.Helper.commitAppsAndApks(context);
   RepoProvider.Helper.update(context, repo, repoDetailsToSave);
 }