package cm;

import android.graphics.Rect;
import android.util.Log;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/* loaded from: classes3.dex */
public abstract class q {

    /* renamed from: a, reason: collision with root package name */
    private static final String f12104a = "q";

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes3.dex */
    public class a implements Comparator {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ bm.q f12105p;

        a(bm.q qVar) {
            this.f12105p = qVar;
        }

        @Override // java.util.Comparator
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public int compare(bm.q qVar, bm.q qVar2) {
            return Float.compare(q.this.c(qVar2, this.f12105p), q.this.c(qVar, this.f12105p));
        }
    }

    public List a(List list, bm.q qVar) {
        if (qVar == null) {
            return list;
        }
        Collections.sort(list, new a(qVar));
        return list;
    }

    public bm.q b(List list, bm.q qVar) {
        List a10 = a(list, qVar);
        String str = f12104a;
        Log.i(str, "Viewfinder size: " + qVar);
        Log.i(str, "Preview in order of preference: " + a10);
        return (bm.q) a10.get(0);
    }

    protected abstract float c(bm.q qVar, bm.q qVar2);

    public abstract Rect d(bm.q qVar, bm.q qVar2);
}
