Example #1
0
 private boolean hashMatches() {
   if (!localFile.exists()) {
     return false;
   }
   Hasher hasher = createHasher();
   return hasher != null && hasher.match(curApk.hash);
 }
    private void tagRepo() throws IOException, LocalRepoKeyStore.InitException {

      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

      // max age is an EditTextPreference, which is always a String
      int repoMaxAge =
          Float.valueOf(prefs.getString("max_repo_age_days", DEFAULT_REPO_MAX_AGE_DAYS)).intValue();

      serializer.startTag("", "repo");

      serializer.attribute("", "icon", "blah.png");
      serializer.attribute("", "maxage", String.valueOf(repoMaxAge));
      serializer.attribute(
          "", "name", Preferences.get().getLocalRepoName() + " on " + FDroidApp.ipAddressString);
      serializer.attribute(
          "", "pubkey", Hasher.hex(LocalRepoKeyStore.get(context).getCertificate()));
      long timestamp = System.currentTimeMillis() / 1000L;
      serializer.attribute("", "timestamp", String.valueOf(timestamp));

      tag(
          "description",
          "A local FDroid repo generated from apps installed on "
              + Preferences.get().getLocalRepoName());

      serializer.endTag("", "repo");
    }