LoadPackagesAsyncTask.java (zxing-zxing-3.4.0) | : | LoadPackagesAsyncTask.java (zxing-zxing-3.4.1) | ||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
import java.util.Collections; | import java.util.Collections; | |||
import java.util.List; | import java.util.List; | |||
/** | /** | |||
* Loads a list of packages installed on the device asynchronously. | * Loads a list of packages installed on the device asynchronously. | |||
* | * | |||
* @author Sean Owen | * @author Sean Owen | |||
*/ | */ | |||
final class LoadPackagesAsyncTask extends AsyncTask<Object,Object,List<AppInfo>> { | final class LoadPackagesAsyncTask extends AsyncTask<Object,Object,List<AppInfo>> { | |||
private static final String[] PKG_PREFIX_WHITELIST = { | private static final String[] PKG_PREFIX_SAFELIST = { | |||
"com.google.android.apps.", | "com.google.android.apps.", | |||
}; | }; | |||
private static final String[] PKG_PREFIX_BLACKLIST = { | private static final String[] PKG_PREFIX_BLOCKLIST = { | |||
"com.android.", | "com.android.", | |||
"android", | "android", | |||
"com.google.android.", | "com.google.android.", | |||
"com.htc", | "com.htc", | |||
}; | }; | |||
private final ListActivity activity; | private final ListActivity activity; | |||
LoadPackagesAsyncTask(ListActivity activity) { | LoadPackagesAsyncTask(ListActivity activity) { | |||
this.activity = activity; | this.activity = activity; | |||
skipping to change at line 82 | skipping to change at line 82 | |||
} | } | |||
} | } | |||
Collections.sort(labelsPackages); | Collections.sort(labelsPackages); | |||
return labelsPackages; | return labelsPackages; | |||
} | } | |||
private static boolean isHidden(String packageName) { | private static boolean isHidden(String packageName) { | |||
if (packageName == null) { | if (packageName == null) { | |||
return true; | return true; | |||
} | } | |||
for (String prefix : PKG_PREFIX_WHITELIST) { | for (String prefix : PKG_PREFIX_SAFELIST) { | |||
if (packageName.startsWith(prefix)) { | if (packageName.startsWith(prefix)) { | |||
return false; | return false; | |||
} | } | |||
} | } | |||
for (String prefix : PKG_PREFIX_BLACKLIST) { | for (String prefix : PKG_PREFIX_BLOCKLIST) { | |||
if (packageName.startsWith(prefix)) { | if (packageName.startsWith(prefix)) { | |||
return true; | return true; | |||
} | } | |||
} | } | |||
return false; | return false; | |||
} | } | |||
@Override | @Override | |||
protected void onPostExecute(final List<AppInfo> results) { | protected void onPostExecute(final List<AppInfo> results) { | |||
ListAdapter listAdapter = new ArrayAdapter<AppInfo>(activity, | ListAdapter listAdapter = new ArrayAdapter<AppInfo>(activity, | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |