package com.franmontiel.persistentcookiejar; import com.franmontiel.persistentcookiejar.cache.CookieCache; import com.franmontiel.persistentcookiejar.cache.SetCookieCache; import com.franmontiel.persistentcookiejar.persistence.CookiePersistor; import com.franmontiel.persistentcookiejar.persistence.SharedPrefsCookiePersistor; import f0.n; import f0.w; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class PersistentCookieJar implements ClearableCookieJar { public CookieCache b; /* renamed from: c reason: collision with root package name */ public CookiePersistor f2188c; public PersistentCookieJar(CookieCache cookieCache, CookiePersistor cookiePersistor) { this.b = cookieCache; this.f2188c = cookiePersistor; ((SetCookieCache) cookieCache).addAll(((SharedPrefsCookiePersistor) cookiePersistor).c()); } @Override // f0.p public synchronized void a(w wVar, List list) { this.b.addAll(list); CookiePersistor cookiePersistor = this.f2188c; ArrayList arrayList = new ArrayList(); for (n nVar : list) { if (nVar.m) { arrayList.add(nVar); } } cookiePersistor.a(arrayList); } @Override // f0.p public synchronized List b(w wVar) { ArrayList arrayList; ArrayList arrayList2 = new ArrayList(); arrayList = new ArrayList(); Iterator it = this.b.iterator(); while (it.hasNext()) { n next = it.next(); if (next.h < System.currentTimeMillis()) { arrayList2.add(next); it.remove(); } else if (next.a(wVar)) { arrayList.add(next); } } this.f2188c.removeAll(arrayList2); return arrayList; } }