diff --git a/res/layout/appdetails.xml b/res/layout/appdetails.xml
index 057645189..ee88f8e19 100644
--- a/res/layout/appdetails.xml
+++ b/res/layout/appdetails.xml
@@ -28,6 +28,10 @@
android:textSize="12sp" android:layout_height="wrap_content"
android:layout_width="fill_parent" />
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ddc4145c6..4afc6faec 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -115,4 +115,7 @@
Network Services
Show apps that promote non-free network services
+ Expert
+ Enabled expert mode
+
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index 7baff4fe6..6ad6b66fb 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -7,9 +7,9 @@
+ android:summary="@string/update_apps_list" android:key="updateInterval"
+ android:defaultValue="0" android:entries="@array/updateIntervalNames"
+ android:entryValues="@array/updateIntervalValues" />
@@ -29,9 +29,10 @@
android:key="cacheDownloaded" />
-
-
+
+
+
diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java
index 551e02320..f0cb9a332 100644
--- a/src/org/fdroid/fdroid/AppDetails.java
+++ b/src/org/fdroid/fdroid/AppDetails.java
@@ -22,7 +22,10 @@ import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
+import java.math.BigInteger;
import java.net.URL;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
@@ -43,6 +46,7 @@ import android.widget.TextView;
import android.widget.Toast;
import android.content.pm.PackageManager;
import android.content.pm.PackageInfo;
+import android.content.pm.Signature;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
@@ -162,8 +166,12 @@ public class AppDetails extends ListActivity {
}
private boolean pref_cacheDownloaded;
+ private boolean pref_expert;
private boolean viewResetRequired;
+ // The signature of the installed version.
+ private Signature mInstalledSignature;
+
@Override
protected void onStart() {
super.onStart();
@@ -174,6 +182,7 @@ public class AppDetails extends ListActivity {
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(getBaseContext());
pref_cacheDownloaded = prefs.getBoolean("cacheDownloaded", true);
+ pref_expert = prefs.getBoolean("expert", false);
viewResetRequired = true;
}
@@ -204,6 +213,19 @@ public class AppDetails extends ListActivity {
DB.Apk curver = app.getCurrentVersion();
app_currentvercode = curver == null ? 0 : curver.vercode;
+ // Get the signature of the installed package...
+ mInstalledSignature = null;
+ if (curver != null) {
+ PackageManager pm = getBaseContext().getPackageManager();
+ try {
+ PackageInfo pi = pm.getPackageInfo(appid,
+ PackageManager.GET_SIGNATURES);
+ mInstalledSignature = pi.signatures[0];
+ } catch (NameNotFoundException e) {
+ Log.d("FDroid", "Failed to get installed signature");
+ }
+ }
+
// Set the icon...
ImageView iv = (ImageView) findViewById(R.id.icon);
String icon_path = DB.getIconsPath() + app.icon;
@@ -229,6 +251,23 @@ public class AppDetails extends ListActivity {
app.installedVersion));
tv = (TextView) findViewById(R.id.description);
tv.setText(app.description);
+ if (pref_expert && mInstalledSignature != null) {
+ try {
+ tv = (TextView) findViewById(R.id.signature);
+ byte[] sig = mInstalledSignature.toByteArray();
+ MessageDigest md;
+ md = MessageDigest.getInstance("MD5");
+ byte[] md5sum = new byte[32];
+ md.update(sig, 0, sig.length);
+ md5sum = md.digest();
+ BigInteger bigInt = new BigInteger(1, md5sum);
+ String md5hash = bigInt.toString(16);
+ while (md5hash.length() < 32)
+ md5hash = "0" + md5hash;
+ tv.setText("Signed: " + md5hash);
+ } catch (NoSuchAlgorithmException e) {
+ }
+ }
// Set up the list...
ApkListAdapter la = new ApkListAdapter(this);