mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
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:
parent
c9175ecae2
commit
aee98771a2
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue