package com.google.android.gms.stats;

import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.concurrent.Future;

public class WakeLock$HeldLock {
    private final /* synthetic */ WakeLock zzaei;
    private boolean zzaek;
    private Future zzael;
    private final String zzaem;

    private WakeLock$HeldLock(WakeLock wakeLock, String str) {
        this.zzaei = wakeLock;
        this.zzaek = true;
        this.zzaem = str;
    }

    /* synthetic */ WakeLock$HeldLock(WakeLock wakeLock, String str, zza zza) {
        this(wakeLock, str);
    }

    public void finalize() {
        AppMethodBeat.i(113948);
        if (this.zzaek) {
            String str = "HeldLock finalized while still holding the WakeLock! Reason: ";
            String valueOf = String.valueOf(this.zzaem);
            if (valueOf.length() != 0) {
                str.concat(valueOf);
            } else {
                valueOf = new String(str);
            }
            release(0);
        }
        AppMethodBeat.o(113948);
    }

    public void release() {
        AppMethodBeat.i(113946);
        release(0);
        AppMethodBeat.o(113946);
    }

    public synchronized void release(int i) {
        AppMethodBeat.i(113947);
        if (this.zzaek) {
            this.zzaek = false;
            if (this.zzael != null) {
                this.zzael.cancel(false);
                this.zzael = null;
            }
            WakeLock.zza(this.zzaei, this.zzaem, i);
            AppMethodBeat.o(113947);
        } else {
            AppMethodBeat.o(113947);
        }
    }
}
