package com.google.android.gms.games.internal; import com.google.android.gms.common.data.DataHolder; import com.google.android.gms.games.AnnotatedData; import com.google.android.gms.games.GamesStatusUtils; import com.google.android.gms.games.LeaderboardsClient; import com.google.android.gms.games.leaderboard.Leaderboard; import com.google.android.gms.games.leaderboard.LeaderboardBuffer; import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; import com.google.android.gms.tasks.TaskCompletionSource; /* loaded from: classes2.dex */ final class zzaa extends zza { final /* synthetic */ zzaj zza; private final TaskCompletionSource zzb; public zzaa(zzaj zzajVar, TaskCompletionSource taskCompletionSource) { this.zza = zzajVar; this.zzb = taskCompletionSource; } @Override // com.google.android.gms.games.internal.zza, com.google.android.gms.games.internal.zzal public final void zzf(DataHolder dataHolder, DataHolder dataHolder2) { int statusCode = dataHolder2.getStatusCode(); if (statusCode == 10003) { zzaj.zzq(this.zza, this.zzb); dataHolder.close(); dataHolder2.close(); return; } boolean z = statusCode == 3; if (statusCode != 0 && !z) { GamesStatusUtils.zza(this.zzb, statusCode); dataHolder.close(); dataHolder2.close(); return; } LeaderboardBuffer leaderboardBuffer = new LeaderboardBuffer(dataHolder); try { Leaderboard freeze = leaderboardBuffer.getCount() > 0 ? leaderboardBuffer.get(0).freeze() : null; leaderboardBuffer.close(); this.zzb.setResult(new AnnotatedData(new LeaderboardsClient.LeaderboardScores(freeze, new LeaderboardScoreBuffer(dataHolder2)), z)); } catch (Throwable th) { try { leaderboardBuffer.close(); } catch (Throwable th2) { th.addSuppressed(th2); } throw th; } } }