RepoPersister.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:mobile-store 作者:
private void flushApksToDbInBatch(Map<String, Long> appIds) throws RepoUpdater.UpdateException {
    List<Apk> apksToSaveList = new ArrayList<>();
    for (Map.Entry<String, List<Apk>> entries : apksToSave.entrySet()) {
        for (Apk apk : entries.getValue()) {
            apk.appId = appIds.get(apk.packageName);
        }
        apksToSaveList.addAll(entries.getValue());
    }

    calcApkCompatibilityFlags(apksToSaveList);

    ArrayList<ContentProviderOperation> apkOperations = insertApks(apksToSaveList);

    try {
        context.getContentResolver().applyBatch(TempApkProvider.getAuthority(), apkOperations);
    } catch (RemoteException | OperationApplicationException e) {
        throw new RepoUpdater.UpdateException(repo, "An internal error occurred while updating the database", e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号