hq.java 16.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583
import android.app.PendingIntent;
import android.content.Context;
import android.os.Bundle;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.ArrayMap;
import android.util.Log;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.Api.zza;
import com.google.android.gms.common.api.Api.zzb;
import com.google.android.gms.common.api.Api.zzc;
import com.google.android.gms.common.api.Api.zze;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.internal.zzac;
import com.google.android.gms.common.internal.zzg;
import com.google.android.gms.common.zze;
import com.google.android.gms.internal.zzaad.zza;
import com.google.android.gms.internal.zzaag;
import com.google.android.gms.internal.zzaat;
import com.google.android.gms.internal.zzaav;
import com.google.android.gms.internal.zzabc;
import com.google.android.gms.internal.zzabc.zza;
import com.google.android.gms.internal.zzabq;
import com.google.android.gms.internal.zzbai;
import com.google.android.gms.internal.zzbaj;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;

public final class hq
  implements zzabc
{
  private final Context a;
  private final zzaat b;
  private final Looper c;
  private final zzaav d;
  private final zzaav e;
  private final Map<Api.zzc<?>, zzaav> f;
  private final Set<zzabq> g = Collections.newSetFromMap(new WeakHashMap());
  private final Api.zze h;
  private Bundle i;
  private ConnectionResult j = null;
  private ConnectionResult k = null;
  private boolean l = false;
  private final Lock m;
  private int n = 0;
  
  private hq(Context paramContext, zzaat paramzzaat, Lock paramLock, Looper paramLooper, zze paramzze, Map<Api.zzc<?>, Api.zze> paramMap1, Map<Api.zzc<?>, Api.zze> paramMap2, zzg paramzzg, Api.zza<? extends zzbai, zzbaj> paramzza, Api.zze paramzze1, ArrayList<zzaag> paramArrayList1, ArrayList<zzaag> paramArrayList2, Map<Api<?>, Boolean> paramMap3, Map<Api<?>, Boolean> paramMap4)
  {
    this.a = paramContext;
    this.b = paramzzaat;
    this.m = paramLock;
    this.c = paramLooper;
    this.h = paramzze1;
    this.d = new zzaav(paramContext, this.b, paramLock, paramLooper, paramzze, paramMap2, null, paramMap4, null, paramArrayList2, new hq.a((byte)0));
    this.e = new zzaav(paramContext, this.b, paramLock, paramLooper, paramzze, paramMap1, paramzzg, paramMap3, paramzza, paramArrayList1, new hq.b((byte)0));
    paramContext = new ArrayMap();
    paramzzaat = paramMap2.keySet().iterator();
    while (paramzzaat.hasNext()) {
      paramContext.put((Api.zzc)paramzzaat.next(), this.d);
    }
    paramzzaat = paramMap1.keySet().iterator();
    while (paramzzaat.hasNext()) {
      paramContext.put((Api.zzc)paramzzaat.next(), this.e);
    }
    this.f = Collections.unmodifiableMap(paramContext);
  }
  
  public static hq a(Context paramContext, zzaat paramzzaat, Lock paramLock, Looper paramLooper, zze paramzze, Map<Api.zzc<?>, Api.zze> paramMap, zzg paramzzg, Map<Api<?>, Boolean> paramMap1, Api.zza<? extends zzbai, zzbaj> paramzza, ArrayList<zzaag> paramArrayList)
  {
    Object localObject1 = null;
    ArrayMap localArrayMap1 = new ArrayMap();
    ArrayMap localArrayMap2 = new ArrayMap();
    Object localObject2 = paramMap.entrySet().iterator();
    paramMap = (Map<Api.zzc<?>, Api.zze>)localObject1;
    while (((Iterator)localObject2).hasNext())
    {
      localObject3 = (Map.Entry)((Iterator)localObject2).next();
      localObject1 = (Api.zze)((Map.Entry)localObject3).getValue();
      if (((Api.zze)localObject1).zzrr()) {
        paramMap = (Map<Api.zzc<?>, Api.zze>)localObject1;
      }
      if (((Api.zze)localObject1).zzrd()) {
        localArrayMap1.put((Api.zzc)((Map.Entry)localObject3).getKey(), localObject1);
      } else {
        localArrayMap2.put((Api.zzc)((Map.Entry)localObject3).getKey(), localObject1);
      }
    }
    boolean bool;
    if (!localArrayMap1.isEmpty())
    {
      bool = true;
      zzac.zza(bool, "CompositeGoogleApiClient should not be used without any APIs that require sign-in.");
      localObject1 = new ArrayMap();
      localObject2 = new ArrayMap();
      localObject3 = paramMap1.keySet().iterator();
    }
    Object localObject4;
    for (;;)
    {
      if (((Iterator)localObject3).hasNext())
      {
        localObject4 = (Api)((Iterator)localObject3).next();
        Api.zzc localzzc = ((Api)localObject4).zzvg();
        if (localArrayMap1.containsKey(localzzc))
        {
          ((Map)localObject1).put(localObject4, (Boolean)paramMap1.get(localObject4));
          continue;
          bool = false;
          break;
        }
        if (localArrayMap2.containsKey(localzzc)) {
          ((Map)localObject2).put(localObject4, (Boolean)paramMap1.get(localObject4));
        } else {
          throw new IllegalStateException("Each API in the isOptionalMap must have a corresponding client in the clients map.");
        }
      }
    }
    paramMap1 = new ArrayList();
    Object localObject3 = new ArrayList();
    paramArrayList = paramArrayList.iterator();
    while (paramArrayList.hasNext())
    {
      localObject4 = (zzaag)paramArrayList.next();
      if (((Map)localObject1).containsKey(((zzaag)localObject4).zzaxf)) {
        paramMap1.add(localObject4);
      } else if (((Map)localObject2).containsKey(((zzaag)localObject4).zzaxf)) {
        ((ArrayList)localObject3).add(localObject4);
      } else {
        throw new IllegalStateException("Each ClientCallbacks must have a corresponding API in the isOptionalMap");
      }
    }
    return new hq(paramContext, paramzzaat, paramLock, paramLooper, paramzze, localArrayMap1, localArrayMap2, paramzzg, paramzza, paramMap, paramMap1, (ArrayList)localObject3, (Map)localObject1, (Map)localObject2);
  }
  
  private void a()
  {
    Iterator localIterator = this.g.iterator();
    while (localIterator.hasNext()) {
      ((zzabq)localIterator.next()).zzrq();
    }
    this.g.clear();
  }
  
  private void a(ConnectionResult paramConnectionResult)
  {
    switch (this.n)
    {
    default: 
      Log.wtf("CompositeGAC", "Attempted to call failure callbacks in CONNECTION_MODE_NONE. Callbacks should be disabled via GmsClientSupervisor", new Exception());
    }
    for (;;)
    {
      this.n = 0;
      return;
      this.b.zzc(paramConnectionResult);
      a();
    }
  }
  
  private boolean a(zzaad.zza<? extends Result, ? extends Api.zzb> paramzza)
  {
    paramzza = paramzza.zzvg();
    zzac.zzb(this.f.containsKey(paramzza), "GoogleApiClient is not configured to use the API required for this call.");
    return ((zzaav)this.f.get(paramzza)).equals(this.e);
  }
  
  private boolean b()
  {
    return (this.k != null) && (this.k.getErrorCode() == 4);
  }
  
  private static boolean b(ConnectionResult paramConnectionResult)
  {
    return (paramConnectionResult != null) && (paramConnectionResult.isSuccess());
  }
  
  @Nullable
  private PendingIntent c()
  {
    if (this.h == null) {
      return null;
    }
    return PendingIntent.getActivity(this.a, this.b.getSessionId(), this.h.zzrs(), 134217728);
  }
  
  public final ConnectionResult blockingConnect()
  {
    throw new UnsupportedOperationException();
  }
  
  public final ConnectionResult blockingConnect(long paramLong, @NonNull TimeUnit paramTimeUnit)
  {
    throw new UnsupportedOperationException();
  }
  
  public final void connect()
  {
    this.n = 2;
    this.l = false;
    this.k = null;
    this.j = null;
    this.d.connect();
    this.e.connect();
  }
  
  public final void disconnect()
  {
    this.k = null;
    this.j = null;
    this.n = 0;
    this.d.disconnect();
    this.e.disconnect();
    a();
  }
  
  public final void dump(String paramString, FileDescriptor paramFileDescriptor, PrintWriter paramPrintWriter, String[] paramArrayOfString)
  {
    paramPrintWriter.append(paramString).append("authClient").println(":");
    this.e.dump(String.valueOf(paramString).concat("  "), paramFileDescriptor, paramPrintWriter, paramArrayOfString);
    paramPrintWriter.append(paramString).append("anonClient").println(":");
    this.d.dump(String.valueOf(paramString).concat("  "), paramFileDescriptor, paramPrintWriter, paramArrayOfString);
  }
  
  @Nullable
  public final ConnectionResult getConnectionResult(@NonNull Api<?> paramApi)
  {
    if (((zzaav)this.f.get(paramApi.zzvg())).equals(this.e))
    {
      if (b()) {
        return new ConnectionResult(4, c());
      }
      return this.e.getConnectionResult(paramApi);
    }
    return this.d.getConnectionResult(paramApi);
  }
  
  /* Error */
  public final boolean isConnected()
  {
    // Byte code:
    //   0: iconst_1
    //   1: istore_3
    //   2: aload_0
    //   3: getfield 70	hq:m	Ljava/util/concurrent/locks/Lock;
    //   6: invokeinterface 366 1 0
    //   11: aload_0
    //   12: getfield 84	hq:d	Lcom/google/android/gms/internal/zzaav;
    //   15: invokevirtual 368	com/google/android/gms/internal/zzaav:isConnected	()Z
    //   18: ifeq +47 -> 65
    //   21: iload_3
    //   22: istore_2
    //   23: aload_0
    //   24: getfield 87	hq:e	Lcom/google/android/gms/internal/zzaav;
    //   27: invokevirtual 368	com/google/android/gms/internal/zzaav:isConnected	()Z
    //   30: ifne +24 -> 54
    //   33: iload_3
    //   34: istore_2
    //   35: aload_0
    //   36: invokespecial 264	hq:b	()Z
    //   39: ifne +15 -> 54
    //   42: aload_0
    //   43: getfield 64	hq:n	I
    //   46: istore_1
    //   47: iload_1
    //   48: iconst_1
    //   49: if_icmpne +16 -> 65
    //   52: iload_3
    //   53: istore_2
    //   54: aload_0
    //   55: getfield 70	hq:m	Ljava/util/concurrent/locks/Lock;
    //   58: invokeinterface 371 1 0
    //   63: iload_2
    //   64: ireturn
    //   65: iconst_0
    //   66: istore_2
    //   67: goto -13 -> 54
    //   70: astore 4
    //   72: aload_0
    //   73: getfield 70	hq:m	Ljava/util/concurrent/locks/Lock;
    //   76: invokeinterface 371 1 0
    //   81: aload 4
    //   83: athrow
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	84	0	this	hq
    //   46	4	1	i1	int
    //   22	45	2	bool1	boolean
    //   1	52	3	bool2	boolean
    //   70	12	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   11	21	70	finally
    //   23	33	70	finally
    //   35	47	70	finally
  }
  
  /* Error */
  public final boolean isConnecting()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 70	hq:m	Ljava/util/concurrent/locks/Lock;
    //   4: invokeinterface 366 1 0
    //   9: aload_0
    //   10: getfield 64	hq:n	I
    //   13: istore_1
    //   14: iload_1
    //   15: iconst_2
    //   16: if_icmpne +16 -> 32
    //   19: iconst_1
    //   20: istore_2
    //   21: aload_0
    //   22: getfield 70	hq:m	Ljava/util/concurrent/locks/Lock;
    //   25: invokeinterface 371 1 0
    //   30: iload_2
    //   31: ireturn
    //   32: iconst_0
    //   33: istore_2
    //   34: goto -13 -> 21
    //   37: astore_3
    //   38: aload_0
    //   39: getfield 70	hq:m	Ljava/util/concurrent/locks/Lock;
    //   42: invokeinterface 371 1 0
    //   47: aload_3
    //   48: athrow
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	49	0	this	hq
    //   13	4	1	i1	int
    //   20	14	2	bool	boolean
    //   37	11	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   9	14	37	finally
  }
  
  public final <A extends Api.zzb, R extends Result, T extends zzaad.zza<R, A>> T zza(@NonNull T paramT)
  {
    if (a(paramT))
    {
      if (b())
      {
        paramT.zzB(new Status(4, null, c()));
        return paramT;
      }
      return this.e.zza(paramT);
    }
    return this.d.zza(paramT);
  }
  
  public final boolean zza(zzabq paramzzabq)
  {
    this.m.lock();
    try
    {
      if (((isConnecting()) || (isConnected())) && (!this.e.isConnected()))
      {
        this.g.add(paramzzabq);
        if (this.n == 0) {
          this.n = 1;
        }
        this.k = null;
        this.e.connect();
        return true;
      }
      return false;
    }
    finally
    {
      this.m.unlock();
    }
  }
  
  public final <A extends Api.zzb, T extends zzaad.zza<? extends Result, A>> T zzb(@NonNull T paramT)
  {
    if (a(paramT))
    {
      if (b())
      {
        paramT.zzB(new Status(4, null, c()));
        return paramT;
      }
      return this.e.zzb(paramT);
    }
    return this.d.zzb(paramT);
  }
  
  public final void zzvM()
  {
    this.d.zzvM();
    this.e.zzvM();
  }
  
  /* Error */
  public final void zzvn()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 70	hq:m	Ljava/util/concurrent/locks/Lock;
    //   4: invokeinterface 366 1 0
    //   9: aload_0
    //   10: invokevirtual 390	hq:isConnecting	()Z
    //   13: istore_1
    //   14: aload_0
    //   15: getfield 87	hq:e	Lcom/google/android/gms/internal/zzaav;
    //   18: invokevirtual 277	com/google/android/gms/internal/zzaav:disconnect	()V
    //   21: aload_0
    //   22: new 281	com/google/android/gms/common/ConnectionResult
    //   25: dup
    //   26: iconst_4
    //   27: invokespecial 402	com/google/android/gms/common/ConnectionResult:<init>	(I)V
    //   30: putfield 60	hq:k	Lcom/google/android/gms/common/ConnectionResult;
    //   33: iload_1
    //   34: ifeq +36 -> 70
    //   37: new 404	android/os/Handler
    //   40: dup
    //   41: aload_0
    //   42: getfield 72	hq:c	Landroid/os/Looper;
    //   45: invokespecial 407	android/os/Handler:<init>	(Landroid/os/Looper;)V
    //   48: new 8	hq$1
    //   51: dup
    //   52: aload_0
    //   53: invokespecial 409	hq$1:<init>	(Lhq;)V
    //   56: invokevirtual 413	android/os/Handler:post	(Ljava/lang/Runnable;)Z
    //   59: pop
    //   60: aload_0
    //   61: getfield 70	hq:m	Ljava/util/concurrent/locks/Lock;
    //   64: invokeinterface 371 1 0
    //   69: return
    //   70: aload_0
    //   71: invokespecial 231	hq:a	()V
    //   74: goto -14 -> 60
    //   77: astore_2
    //   78: aload_0
    //   79: getfield 70	hq:m	Ljava/util/concurrent/locks/Lock;
    //   82: invokeinterface 371 1 0
    //   87: aload_2
    //   88: athrow
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	89	0	this	hq
    //   13	21	1	bool	boolean
    //   77	11	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   9	33	77	finally
    //   37	60	77	finally
    //   70	74	77	finally
  }
  
  final class a
    implements zzabc.zza
  {
    private a() {}
    
    public final void zzc(int paramInt, boolean paramBoolean)
    {
      hq.a(hq.this).lock();
      try
      {
        if ((hq.c(hq.this)) || (hq.d(hq.this) == null) || (!hq.d(hq.this).isSuccess()))
        {
          hq.a(hq.this, false);
          hq.a(hq.this, paramInt, paramBoolean);
          return;
        }
        hq.a(hq.this, true);
        hq.e(hq.this).onConnectionSuspended(paramInt);
        return;
      }
      finally
      {
        hq.a(hq.this).unlock();
      }
    }
    
    public final void zzc(@NonNull ConnectionResult paramConnectionResult)
    {
      hq.a(hq.this).lock();
      try
      {
        hq.a(hq.this, paramConnectionResult);
        hq.b(hq.this);
        return;
      }
      finally
      {
        hq.a(hq.this).unlock();
      }
    }
    
    public final void zzo(@Nullable Bundle paramBundle)
    {
      hq.a(hq.this).lock();
      try
      {
        hq.a(hq.this, paramBundle);
        hq.a(hq.this, ConnectionResult.zzayj);
        hq.b(hq.this);
        return;
      }
      finally
      {
        hq.a(hq.this).unlock();
      }
    }
  }
  
  final class b
    implements zzabc.zza
  {
    private b() {}
    
    public final void zzc(int paramInt, boolean paramBoolean)
    {
      hq.a(hq.this).lock();
      try
      {
        if (hq.c(hq.this))
        {
          hq.a(hq.this, false);
          hq.a(hq.this, paramInt, paramBoolean);
          return;
        }
        hq.a(hq.this, true);
        hq.f(hq.this).onConnectionSuspended(paramInt);
        return;
      }
      finally
      {
        hq.a(hq.this).unlock();
      }
    }
    
    public final void zzc(@NonNull ConnectionResult paramConnectionResult)
    {
      hq.a(hq.this).lock();
      try
      {
        hq.b(hq.this, paramConnectionResult);
        hq.b(hq.this);
        return;
      }
      finally
      {
        hq.a(hq.this).unlock();
      }
    }
    
    public final void zzo(@Nullable Bundle paramBundle)
    {
      hq.a(hq.this).lock();
      try
      {
        hq.b(hq.this, ConnectionResult.zzayj);
        hq.b(hq.this);
        return;
      }
      finally
      {
        hq.a(hq.this).unlock();
      }
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/hq.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */