mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-30 12:32:17 -05:00
much better version reading by directly looking for the APG package, rather than looping through all installed packages
This commit is contained in:
parent
dcce05f3df
commit
bda9745d8b
@ -37,7 +37,6 @@ import java.util.Date;
|
|||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -90,6 +89,7 @@ import org.thialfihar.android.apg.utils.IterableIterator;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -1836,19 +1836,14 @@ public class Apg {
|
|||||||
if (VERSION != null) {
|
if (VERSION != null) {
|
||||||
return VERSION;
|
return VERSION;
|
||||||
}
|
}
|
||||||
List<PackageInfo> packs = context.getPackageManager().getInstalledPackages(0);
|
try {
|
||||||
for (int i = 0; i < packs.size(); ++i) {
|
PackageInfo pi = context.getPackageManager().getPackageInfo(mApgPackageName, 0);
|
||||||
PackageInfo p = packs.get(i);
|
VERSION = pi.versionName;
|
||||||
if (!p.packageName.equals(mApgPackageName)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
VERSION = p.versionName;
|
|
||||||
return VERSION;
|
return VERSION;
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
// unpossible!
|
||||||
|
return "0.0.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
// unpossible!
|
|
||||||
return "0.0.0";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFullVersion(Context context) {
|
public static String getFullVersion(Context context) {
|
||||||
|
Loading…
Reference in New Issue
Block a user