Make CommaSeparatedList.make() also take String[]
This commit is contained in:
parent
7b4cee35c7
commit
45ab80bb29
@ -480,9 +480,9 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
* in order to see if, and why an apk is not compatible.
|
* in order to see if, and why an apk is not compatible.
|
||||||
*/
|
*/
|
||||||
private static void calcApkCompatibilityFlags(Context context, List<Apk> apks) {
|
private static void calcApkCompatibilityFlags(Context context, List<Apk> apks) {
|
||||||
CompatibilityChecker checker = new CompatibilityChecker(context);
|
final CompatibilityChecker checker = new CompatibilityChecker(context);
|
||||||
for (Apk apk : apks) {
|
for (final Apk apk : apks) {
|
||||||
List<String> reasons = checker.getIncompatibleReasons(apk);
|
final List<String> reasons = checker.getIncompatibleReasons(apk);
|
||||||
if (reasons.size() > 0) {
|
if (reasons.size() > 0) {
|
||||||
apk.compatible = false;
|
apk.compatible = false;
|
||||||
apk.incompatible_reasons = Utils.CommaSeparatedList.make(reasons);
|
apk.incompatible_reasons = Utils.CommaSeparatedList.make(reasons);
|
||||||
|
@ -430,6 +430,19 @@ public final class Utils {
|
|||||||
return new CommaSeparatedList(sb.toString());
|
return new CommaSeparatedList(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CommaSeparatedList make(String[] list) {
|
||||||
|
if (list == null || list.length == 0)
|
||||||
|
return null;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < list.length; i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
sb.append(',');
|
||||||
|
}
|
||||||
|
sb.append(list[i]);
|
||||||
|
}
|
||||||
|
return new CommaSeparatedList(sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
public static CommaSeparatedList make(String list) {
|
public static CommaSeparatedList make(String list) {
|
||||||
if (list == null || list.length() == 0)
|
if (list == null || list.length() == 0)
|
||||||
return null;
|
return null;
|
||||||
|
@ -262,27 +262,18 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
apk.minSdkVersion = Utils.getMinSdkVersion(context, packageName);
|
apk.minSdkVersion = Utils.getMinSdkVersion(context, packageName);
|
||||||
apk.id = this.id;
|
apk.id = this.id;
|
||||||
apk.installedFile = apkFile;
|
apk.installedFile = apkFile;
|
||||||
if (packageInfo.requestedPermissions == null)
|
apk.permissions = Utils.CommaSeparatedList.make(packageInfo.requestedPermissions);
|
||||||
apk.permissions = null;
|
|
||||||
else
|
|
||||||
apk.permissions = Utils.CommaSeparatedList.make(
|
|
||||||
Arrays.asList(packageInfo.requestedPermissions));
|
|
||||||
apk.apkName = apk.id + "_" + apk.vercode + ".apk";
|
apk.apkName = apk.id + "_" + apk.vercode + ".apk";
|
||||||
|
|
||||||
final FeatureInfo[] features = packageInfo.reqFeatures;
|
final FeatureInfo[] features = packageInfo.reqFeatures;
|
||||||
|
|
||||||
if (features != null && features.length > 0) {
|
if (features != null && features.length > 0) {
|
||||||
final List<String> featureNames = new ArrayList<>(features.length);
|
final String[] featureNames = new String[features.length];
|
||||||
|
for (int i = 0; i < features.length; i++) {
|
||||||
for (FeatureInfo feature : features) {
|
featureNames[i] = features[i].name;
|
||||||
featureNames.add(feature.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apk.features = Utils.CommaSeparatedList.make(featureNames);
|
apk.features = Utils.CommaSeparatedList.make(featureNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signature[] sigs = pkgInfo.signatures;
|
|
||||||
|
|
||||||
byte[] rawCertBytes;
|
byte[] rawCertBytes;
|
||||||
|
|
||||||
final JarFile apkJar = new JarFile(apkFile);
|
final JarFile apkJar = new JarFile(apkFile);
|
||||||
|
@ -91,8 +91,8 @@ public class AppProvider extends FDroidProvider {
|
|||||||
final ContentResolver resolver = context.getContentResolver();
|
final ContentResolver resolver = context.getContentResolver();
|
||||||
final Uri uri = getContentUri();
|
final Uri uri = getContentUri();
|
||||||
final String[] projection = { DataColumns.CATEGORIES };
|
final String[] projection = { DataColumns.CATEGORIES };
|
||||||
Cursor cursor = resolver.query(uri, projection, null, null, null);
|
final Cursor cursor = resolver.query(uri, projection, null, null, null);
|
||||||
Set<String> categorySet = new HashSet<>();
|
final Set<String> categorySet = new HashSet<>();
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
if (cursor.getCount() > 0) {
|
if (cursor.getCount() > 0) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user