Esempio n. 1
0
  private void checkSavedApps() {
    List<AppItem> cache = mDataManager.getCache();
    List<ApplicationInfo> allAppInfos = mDataManager.getAllAppInfos();
    for (AppItem next : cache) {
      boolean currHas = false;
      for (ApplicationInfo applicationInfo : allAppInfos) {
        if (applicationInfo.packageName.equals(next.getPackageName())) {
          currHas = true;
          break;
        }
      }

      if (!currHas) {
        deleteApp(next);
        LOGGER.i(TAG, "delete = " + next);
      }
    }
  }
Esempio n. 2
0
  private void checkCurrApps() {
    List<ApplicationInfo> allAppInfos = mDataManager.getAllAppInfos();
    List<AppItem> cache = mDataManager.getCache();
    for (ApplicationInfo next : allAppInfos) {
      boolean hasSave = false;
      for (AppItem appItem : cache) {
        if (appItem.getPackageName().equals(next.packageName)) {
          hasSave = true;
        }
      }

      if (!hasSave) {
        try {
          AppItem appItem = getAppItem(next);
          saveAppItem(appItem);
          LOGGER.i(TAG, "add = " + appItem);
        } catch (SQLException | FileNotFoundException e) {
          e.printStackTrace();
        }
      }
    }
  }