Make use of List.contains(o) since it already does .equals()
This commit is contained in:
		
							parent
							
								
									ea559d0675
								
							
						
					
					
						commit
						0506160f7b
					
				@ -25,21 +25,17 @@ public class AppFilter {
 | 
				
			|||||||
    // Return true if the given app should be filtered out based on user
 | 
					    // Return true if the given app should be filtered out based on user
 | 
				
			||||||
    // preferences, and false otherwise.
 | 
					    // preferences, and false otherwise.
 | 
				
			||||||
    public boolean filter(App app) {
 | 
					    public boolean filter(App app) {
 | 
				
			||||||
 | 
					        if (app.requirements == null) {
 | 
				
			||||||
        final boolean dontFilterRequiringRoot = Preferences.get().filterAppsRequiringRoot();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (app.requirements == null || dontFilterRequiringRoot) {
 | 
					 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (final String r : app.requirements) {
 | 
					        if (!Preferences.get().filterAppsRequiringRoot()) {
 | 
				
			||||||
            if (r.equals("root")) {
 | 
					            if (app.requirements.contains("root")) {
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -62,9 +62,11 @@ public class CompatibilityChecker extends Compatibility {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private boolean compatibleApi(Utils.CommaSeparatedList nativecode) {
 | 
					    private boolean compatibleApi(Utils.CommaSeparatedList nativecode) {
 | 
				
			||||||
        if (nativecode == null) return true;
 | 
					        if (nativecode == null) {
 | 
				
			||||||
        for (final String abi : nativecode) {
 | 
					            return true;
 | 
				
			||||||
            if (Utils.arrayContains(cpuAbis, abi)) {
 | 
					        }
 | 
				
			||||||
 | 
					        for (final String cpuAbi : cpuAbis) {
 | 
				
			||||||
 | 
					            if (nativecode.contains(cpuAbi)) {
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -617,19 +617,11 @@ public class UpdateService extends IntentService implements ProgressListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        List<ContentProviderOperation> operations = new ArrayList<>();
 | 
					        List<ContentProviderOperation> operations = new ArrayList<>();
 | 
				
			||||||
        List<String> knownAppIds = getKnownAppIds(appsToUpdate);
 | 
					        List<String> knownAppIds = getKnownAppIds(appsToUpdate);
 | 
				
			||||||
        for (final App a : appsToUpdate) {
 | 
					        for (final App app : appsToUpdate) {
 | 
				
			||||||
            boolean known = false;
 | 
					            if (knownAppIds.contains(app.id)) {
 | 
				
			||||||
            for (final String knownId : knownAppIds) {
 | 
					                operations.add(updateExistingApp(app));
 | 
				
			||||||
                if (knownId.equals(a.id)) {
 | 
					 | 
				
			||||||
                    known = true;
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (known) {
 | 
					 | 
				
			||||||
                operations.add(updateExistingApp(a));
 | 
					 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                operations.add(insertNewApp(a));
 | 
					                operations.add(insertNewApp(app));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -506,15 +506,6 @@ public final class Utils {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static <T> boolean arrayContains(final T[] array, final T v) {
 | 
					 | 
				
			||||||
        for (final T e : array) {
 | 
					 | 
				
			||||||
            if (e == v || v != null && v.equals(e)) {
 | 
					 | 
				
			||||||
                return true;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Remove all files from the {@parm directory} either beginning with {@param startsWith}
 | 
					     * Remove all files from the {@parm directory} either beginning with {@param startsWith}
 | 
				
			||||||
     * or ending with {@param endsWith}. Note that if the SD card is not ready, then the
 | 
					     * or ending with {@param endsWith}. Note that if the SD card is not ready, then the
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user