package com.google.android.gms.vision.face; import android.util.SparseArray; import com.google.android.gms.vision.Detector; import com.google.android.gms.vision.FocusingProcessor; import com.google.android.gms.vision.Tracker; /* loaded from: classes2.dex */ public class LargestFaceFocusingProcessor extends FocusingProcessor { public LargestFaceFocusingProcessor(Detector detector, Tracker tracker) { super(detector, tracker); } /* loaded from: classes2.dex */ public static class Builder { private LargestFaceFocusingProcessor zzcp; public Builder(Detector detector, Tracker tracker) { this.zzcp = new LargestFaceFocusingProcessor(detector, tracker); } public Builder setMaxGapFrames(int i) { this.zzcp.zza(i); return this; } public LargestFaceFocusingProcessor build() { return this.zzcp; } } @Override // com.google.android.gms.vision.FocusingProcessor public int selectFocus(Detector.Detections detections) { SparseArray detectedItems = detections.getDetectedItems(); if (detectedItems.size() == 0) { throw new IllegalArgumentException("No faces for selectFocus."); } int keyAt = detectedItems.keyAt(0); float width = detectedItems.valueAt(0).getWidth(); for (int i = 1; i < detectedItems.size(); i++) { int keyAt2 = detectedItems.keyAt(i); float width2 = detectedItems.valueAt(i).getWidth(); if (width2 > width) { keyAt = keyAt2; width = width2; } } return keyAt; } }