package o;

import android.content.ComponentCallbacks2;
import android.content.res.Configuration;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.Map;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class L3 implements ComponentCallbacks2 {
    public final /* synthetic */ Configuration l;
    public final /* synthetic */ FG m;

    public L3(Configuration configuration, FG fg) {
        this.l = configuration;
        this.m = fg;
    }

    @Override // android.content.ComponentCallbacks
    public final void onConfigurationChanged(Configuration configuration) {
        Configuration configuration2 = this.l;
        int iUpdateFrom = configuration2.updateFrom(configuration);
        Iterator it = this.m.a.entrySet().iterator();
        while (it.hasNext()) {
            DG dg = (DG) ((WeakReference) ((Map.Entry) it.next()).getValue()).get();
            if (dg == null || Configuration.needNewResources(iUpdateFrom, dg.b)) {
                it.remove();
            }
        }
        configuration2.setTo(configuration);
    }

    @Override // android.content.ComponentCallbacks
    public final void onLowMemory() {
        this.m.a.clear();
    }

    @Override // android.content.ComponentCallbacks2
    public final void onTrimMemory(int i) {
        this.m.a.clear();
    }
}
