package io.flutter.embedding.android;

import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.view.Window;
import android.view.WindowInsets;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public final class u {
    public static void a(Context context, io.flutter.embedding.engine.renderer.i iVar) {
        Window window;
        Activity activity = id.e.getActivity(context);
        WindowInsets rootWindowInsets = null;
        if (activity != null && (window = activity.getWindow()) != null) {
            rootWindowInsets = window.getDecorView().getRootWindowInsets();
        }
        List listEmptyList = rootWindowInsets == null ? Collections.emptyList() : rootWindowInsets.getBoundingRects(WindowInsets.Type.captionBar());
        int iMax = iVar.f28034d;
        Iterator it = listEmptyList.iterator();
        while (it.hasNext()) {
            iMax = Math.max(iMax, ((Rect) it.next()).bottom);
        }
        iVar.f28034d = iMax;
    }
}
