mirror of
https://github.com/zxing/zxing.git
synced 2025-01-13 04:07:27 -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) {
|
for (ApplicationInfo appInfo : appInfos) {
|
||||||
CharSequence label = appInfo.loadLabel(packageManager);
|
CharSequence label = appInfo.loadLabel(packageManager);
|
||||||
if (label != null) {
|
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[]>() {
|
Collections.sort(labelsPackages, new Comparator<String[]>() {
|
||||||
|
@ -54,6 +57,13 @@ final class LoadPackagesAsyncTask extends AsyncTask<List<String[]>,Void,List<Str
|
||||||
return labelsPackages;
|
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
|
@Override
|
||||||
protected void onPostExecute(List<String[]> results) {
|
protected void onPostExecute(List<String[]> results) {
|
||||||
List<String> labels = new ArrayList<String>(results.size());
|
List<String> labels = new ArrayList<String>(results.size());
|
||||||
|
|
Loading…
Reference in a new issue