|
9 | 9 | import android.os.Build; |
10 | 10 | import android.os.Bundle; |
11 | 11 | import android.support.v4.content.ContextCompat; |
| 12 | +import android.content.pm.PackageInfo; |
12 | 13 | import android.support.v7.app.AppCompatActivity; |
13 | 14 | import android.util.Log; |
14 | 15 | import android.view.LayoutInflater; |
@@ -81,7 +82,10 @@ public void onCreate(Bundle savedInstanceState) { |
81 | 82 | for (File aFile : file) { |
82 | 83 | Log.d(TAG, aFile.getAbsolutePath()); |
83 | 84 | File apkFile = new File(aFile.getAbsolutePath()); |
84 | | - savedApis.add(new SavedApi(apkFile, apkFile.getName(), apkFile.lastModified(), apkFile.getAbsolutePath())); |
| 85 | + PackageInfo info = getActivity().getPackageManager().getPackageArchiveInfo(apkFile.getAbsolutePath(),0); |
| 86 | + if(info!=null&&info.packageName!=null&&info.packageName.startsWith("org.buildmlearn.")) { |
| 87 | + savedApis.add(new SavedApi(apkFile, apkFile.getName(), apkFile.lastModified(), apkFile.getAbsolutePath())); |
| 88 | + } |
85 | 89 | } |
86 | 90 |
|
87 | 91 | Collections.sort(savedApis, new Comparator<SavedApi>() { |
@@ -184,7 +188,10 @@ public void onResume() { |
184 | 188 | for (File aFile : file) { |
185 | 189 | if (aFile.getName().contains(".apk")) { |
186 | 190 | File apkFile = new File(aFile.getAbsolutePath()); |
187 | | - savedApis.add(new SavedApi(apkFile, apkFile.getName(), apkFile.lastModified(), apkFile.getAbsolutePath())); |
| 191 | + PackageInfo info = getActivity().getPackageManager().getPackageArchiveInfo(apkFile.getAbsolutePath(),0); |
| 192 | + if(info!=null&&info.packageName!=null&&info.packageName.startsWith("org.buildmlearn.")) { |
| 193 | + savedApis.add(new SavedApi(apkFile, apkFile.getName(), apkFile.lastModified(), apkFile.getAbsolutePath())); |
| 194 | + } |
188 | 195 | } |
189 | 196 | } |
190 | 197 |
|
|
0 commit comments