Send client version when requesting index.jar

This will allow us to deal with future incompatibilities if necessary,
and also to determine how far back we need to support.
This commit is contained in:
Ciaran Gultnieks 2012-01-12 17:30:51 +00:00
parent 1b2a1e99ea
commit 15904928ae
2 changed files with 12 additions and 5 deletions

View File

@ -193,9 +193,8 @@ public class FDroid extends TabActivity implements OnItemClickListener, OnItemSe
// Fill in the version...
TextView tv = (TextView) view.findViewById(R.id.version);
PackageManager pm = getPackageManager();
PackageInfo pi;
try {
pi = pm.getPackageInfo(
PackageInfo pi = pm.getPackageInfo(
getApplicationContext().getPackageName(), 0);
tv.setText(pi.versionName);
} catch (Exception e) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 Ciaran Gultnieks, ciaran@ciarang.com
* Copyright (C) 2010-12 Ciaran Gultnieks, ciaran@ciarang.com
* Copyright (C) 2009 Roberto Jacinto, roberto.jacinto@caixamagica.pt
*
* This program is free software; you can redistribute it and/or
@ -45,6 +45,8 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;
public class RepoXMLHandler extends DefaultHandler {
@ -270,8 +272,14 @@ public class RepoXMLHandler extends DefaultHandler {
// check the signature, and extract the index...
Log.d("FDroid", "Getting signed index from "
+ repo.address);
getRemoteFile(ctx, repo.address + "/index.jar",
"tempindex.jar");
String address = repo.address + "/index.jar";
PackageManager pm = ctx.getPackageManager();
try {
PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), 0);
address += "?" + pi.versionName;
} catch (Exception e) {
}
getRemoteFile(ctx, address, "tempindex.jar");
String jarpath = ctx.getFilesDir() + "/tempindex.jar";
JarFile jar;
JarEntry je;