Filter some non-market apps

git-svn-id: https://zxing.googlecode.com/svn/trunk@1124 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2009-11-23 15:26:33 +00:00
parent c9175ecae2
commit aee98771a2

View file

@ -43,7 +43,10 @@ final class LoadPackagesAsyncTask extends AsyncTask<List<String[]>,Void,List<Str
for (ApplicationInfo appInfo : appInfos) {
CharSequence label = appInfo.loadLabel(packageManager);
if (label != null) {
labelsPackages.add(new String[]{label.toString(), appInfo.packageName});
String packageName = appInfo.packageName;
if (!isHidden(packageName)) {
labelsPackages.add(new String[]{label.toString(), packageName});
}
}
}
Collections.sort(labelsPackages, new Comparator<String[]>() {
@ -54,6 +57,13 @@ final class LoadPackagesAsyncTask extends AsyncTask<List<String[]>,Void,List<Str
return labelsPackages;
}
private static boolean isHidden(String packageName) {
return packageName == null ||
packageName.startsWith("com.android.") ||
(packageName.startsWith("com.google.android.") &&
!packageName.startsWith("com.google.android.apps."));
}
@Override
protected void onPostExecute(List<String[]> results) {
List<String> labels = new ArrayList<String>(results.size());