BluetoothCrashResolver.java 22.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 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685
package com.radiusnetworks.bluetooth;

import android.annotation.TargetApi;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAdapter.LeScanCallback;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncTask;
import android.os.Build.VERSION;
import android.util.Log;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

@TargetApi(5)
public class BluetoothCrashResolver
{
  private boolean a = false;
  private boolean b = false;
  private boolean c = false;
  private long d = 0L;
  private long e = 0L;
  private long f = 0L;
  private int g = 0;
  private int h = 0;
  private boolean i = false;
  private long j = 0L;
  private Context k = null;
  private UpdateNotifier l;
  private Set<String> m = new HashSet();
  private a n = new a((byte)0);
  private final BroadcastReceiver o = new BroadcastReceiver()
  {
    public final void onReceive(Context paramAnonymousContext, Intent paramAnonymousIntent)
    {
      paramAnonymousContext = paramAnonymousIntent.getAction();
      if ((paramAnonymousContext.equals("android.bluetooth.adapter.action.DISCOVERY_FINISHED")) && (BluetoothCrashResolver.a(BluetoothCrashResolver.this))) {
        BluetoothCrashResolver.c(BluetoothCrashResolver.this);
      }
      if ((paramAnonymousContext.equals("android.bluetooth.adapter.action.DISCOVERY_STARTED")) && (BluetoothCrashResolver.a(BluetoothCrashResolver.this))) {
        BluetoothCrashResolver.d(BluetoothCrashResolver.this);
      }
      if (paramAnonymousContext.equals("android.bluetooth.adapter.action.STATE_CHANGED")) {}
      switch (paramAnonymousIntent.getIntExtra("android.bluetooth.adapter.extra.STATE", Integer.MIN_VALUE))
      {
      case 13: 
      default: 
      case -2147483648: 
      case 10: 
      case 12: 
        do
        {
          do
          {
            return;
          } while (!BluetoothCrashResolver.b(BluetoothCrashResolver.this));
          return;
          BluetoothCrashResolver.a(BluetoothCrashResolver.this, new Date().getTime());
          return;
          if (BluetoothCrashResolver.b(BluetoothCrashResolver.this)) {
            new StringBuilder("Bluetooth was turned off for ").append(BluetoothCrashResolver.e(BluetoothCrashResolver.this) - BluetoothCrashResolver.f(BluetoothCrashResolver.this)).append(" milliseconds");
          }
        } while (BluetoothCrashResolver.e(BluetoothCrashResolver.this) - BluetoothCrashResolver.f(BluetoothCrashResolver.this) >= 600L);
        BluetoothCrashResolver.this.crashDetected();
        return;
      }
      BluetoothCrashResolver.b(BluetoothCrashResolver.this, new Date().getTime());
    }
  };
  
  public BluetoothCrashResolver(Context paramContext)
  {
    this.k = paramContext.getApplicationContext();
    d();
  }
  
  private void a()
  {
    if (this.l != null) {
      this.l.dataUpdated();
    }
    if (new Date().getTime() - this.j > 60000L) {
      c();
    }
  }
  
  @TargetApi(17)
  private void b()
  {
    this.h += 1;
    BluetoothAdapter localBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    if (!localBluetoothAdapter.isDiscovering())
    {
      Log.w("BluetoothCrashResolver", "Recovery attempt started");
      this.b = true;
      this.c = false;
      if (!localBluetoothAdapter.startDiscovery()) {
        Log.w("BluetoothCrashResolver", "Can't start discovery.  Is bluetooth turned on?");
      }
      if (this.a) {
        new StringBuilder("startDiscovery commanded.  isDiscovering()=").append(localBluetoothAdapter.isDiscovering());
      }
      this.n.a();
      return;
    }
    Log.w("BluetoothCrashResolver", "Already discovering.  Recovery attempt abandoned.");
  }
  
  /* Error */
  private void c()
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_1
    //   2: aload_0
    //   3: new 97	java/util/Date
    //   6: dup
    //   7: invokespecial 98	java/util/Date:<init>	()V
    //   10: invokevirtual 102	java/util/Date:getTime	()J
    //   13: putfield 63	com/radiusnetworks/bluetooth/BluetoothCrashResolver:j	J
    //   16: new 154	java/io/OutputStreamWriter
    //   19: dup
    //   20: aload_0
    //   21: getfield 65	com/radiusnetworks/bluetooth/BluetoothCrashResolver:k	Landroid/content/Context;
    //   24: ldc -100
    //   26: iconst_0
    //   27: invokevirtual 160	android/content/Context:openFileOutput	(Ljava/lang/String;I)Ljava/io/FileOutputStream;
    //   30: invokespecial 163	java/io/OutputStreamWriter:<init>	(Ljava/io/OutputStream;)V
    //   33: astore_2
    //   34: aload_2
    //   35: new 135	java/lang/StringBuilder
    //   38: dup
    //   39: invokespecial 164	java/lang/StringBuilder:<init>	()V
    //   42: aload_0
    //   43: getfield 55	com/radiusnetworks/bluetooth/BluetoothCrashResolver:f	J
    //   46: invokevirtual 167	java/lang/StringBuilder:append	(J)Ljava/lang/StringBuilder;
    //   49: ldc -87
    //   51: invokevirtual 172	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   54: invokevirtual 176	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   57: invokevirtual 179	java/io/OutputStreamWriter:write	(Ljava/lang/String;)V
    //   60: aload_2
    //   61: new 135	java/lang/StringBuilder
    //   64: dup
    //   65: invokespecial 164	java/lang/StringBuilder:<init>	()V
    //   68: aload_0
    //   69: getfield 57	com/radiusnetworks/bluetooth/BluetoothCrashResolver:g	I
    //   72: invokevirtual 182	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   75: ldc -87
    //   77: invokevirtual 172	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   80: invokevirtual 176	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   83: invokevirtual 179	java/io/OutputStreamWriter:write	(Ljava/lang/String;)V
    //   86: aload_2
    //   87: new 135	java/lang/StringBuilder
    //   90: dup
    //   91: invokespecial 164	java/lang/StringBuilder:<init>	()V
    //   94: aload_0
    //   95: getfield 59	com/radiusnetworks/bluetooth/BluetoothCrashResolver:h	I
    //   98: invokevirtual 182	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   101: ldc -87
    //   103: invokevirtual 172	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   106: invokevirtual 176	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   109: invokevirtual 179	java/io/OutputStreamWriter:write	(Ljava/lang/String;)V
    //   112: aload_0
    //   113: getfield 61	com/radiusnetworks/bluetooth/BluetoothCrashResolver:i	Z
    //   116: ifeq +118 -> 234
    //   119: ldc -72
    //   121: astore_1
    //   122: aload_2
    //   123: aload_1
    //   124: invokevirtual 179	java/io/OutputStreamWriter:write	(Ljava/lang/String;)V
    //   127: aload_0
    //   128: getfield 70	com/radiusnetworks/bluetooth/BluetoothCrashResolver:m	Ljava/util/Set;
    //   131: astore_1
    //   132: aload_1
    //   133: monitorenter
    //   134: aload_0
    //   135: getfield 70	com/radiusnetworks/bluetooth/BluetoothCrashResolver:m	Ljava/util/Set;
    //   138: invokeinterface 190 1 0
    //   143: astore_3
    //   144: aload_3
    //   145: invokeinterface 195 1 0
    //   150: ifeq +90 -> 240
    //   153: aload_2
    //   154: aload_3
    //   155: invokeinterface 199 1 0
    //   160: checkcast 201	java/lang/String
    //   163: invokevirtual 179	java/io/OutputStreamWriter:write	(Ljava/lang/String;)V
    //   166: aload_2
    //   167: ldc -87
    //   169: invokevirtual 179	java/io/OutputStreamWriter:write	(Ljava/lang/String;)V
    //   172: goto -28 -> 144
    //   175: astore_3
    //   176: aload_1
    //   177: monitorexit
    //   178: aload_3
    //   179: athrow
    //   180: astore_1
    //   181: aload_2
    //   182: astore_1
    //   183: ldc 120
    //   185: ldc -53
    //   187: invokestatic 128	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;)I
    //   190: pop
    //   191: aload_1
    //   192: ifnull +7 -> 199
    //   195: aload_1
    //   196: invokevirtual 206	java/io/OutputStreamWriter:close	()V
    //   199: aload_0
    //   200: getfield 45	com/radiusnetworks/bluetooth/BluetoothCrashResolver:a	Z
    //   203: ifeq +30 -> 233
    //   206: new 135	java/lang/StringBuilder
    //   209: dup
    //   210: ldc -48
    //   212: invokespecial 140	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   215: aload_0
    //   216: getfield 70	com/radiusnetworks/bluetooth/BluetoothCrashResolver:m	Ljava/util/Set;
    //   219: invokeinterface 212 1 0
    //   224: invokevirtual 182	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   227: ldc -42
    //   229: invokevirtual 172	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   232: pop
    //   233: return
    //   234: ldc -40
    //   236: astore_1
    //   237: goto -115 -> 122
    //   240: aload_1
    //   241: monitorexit
    //   242: aload_2
    //   243: invokevirtual 206	java/io/OutputStreamWriter:close	()V
    //   246: goto -47 -> 199
    //   249: astore_1
    //   250: goto -51 -> 199
    //   253: astore_1
    //   254: aconst_null
    //   255: astore_2
    //   256: aload_2
    //   257: ifnull +7 -> 264
    //   260: aload_2
    //   261: invokevirtual 206	java/io/OutputStreamWriter:close	()V
    //   264: aload_1
    //   265: athrow
    //   266: astore_1
    //   267: goto -68 -> 199
    //   270: astore_2
    //   271: goto -7 -> 264
    //   274: astore_1
    //   275: goto -19 -> 256
    //   278: astore_3
    //   279: aload_1
    //   280: astore_2
    //   281: aload_3
    //   282: astore_1
    //   283: goto -27 -> 256
    //   286: astore_2
    //   287: goto -104 -> 183
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	290	0	this	BluetoothCrashResolver
    //   1	176	1	localObject1	Object
    //   180	1	1	localIOException1	java.io.IOException
    //   182	59	1	localObject2	Object
    //   249	1	1	localIOException2	java.io.IOException
    //   253	12	1	localObject3	Object
    //   266	1	1	localIOException3	java.io.IOException
    //   274	6	1	localObject4	Object
    //   282	1	1	localObject5	Object
    //   33	228	2	localOutputStreamWriter	java.io.OutputStreamWriter
    //   270	1	2	localIOException4	java.io.IOException
    //   280	1	2	localObject6	Object
    //   286	1	2	localIOException5	java.io.IOException
    //   143	12	3	localIterator	java.util.Iterator
    //   175	4	3	localObject7	Object
    //   278	4	3	localObject8	Object
    // Exception table:
    //   from	to	target	type
    //   134	144	175	finally
    //   144	172	175	finally
    //   176	178	175	finally
    //   240	242	175	finally
    //   34	119	180	java/io/IOException
    //   122	134	180	java/io/IOException
    //   178	180	180	java/io/IOException
    //   242	246	249	java/io/IOException
    //   16	34	253	finally
    //   195	199	266	java/io/IOException
    //   260	264	270	java/io/IOException
    //   34	119	274	finally
    //   122	134	274	finally
    //   178	180	274	finally
    //   183	191	278	finally
    //   16	34	286	java/io/IOException
  }
  
  /* Error */
  private void d()
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_1
    //   2: new 225	java/io/BufferedReader
    //   5: dup
    //   6: new 227	java/io/InputStreamReader
    //   9: dup
    //   10: aload_0
    //   11: getfield 65	com/radiusnetworks/bluetooth/BluetoothCrashResolver:k	Landroid/content/Context;
    //   14: ldc -100
    //   16: invokevirtual 231	android/content/Context:openFileInput	(Ljava/lang/String;)Ljava/io/FileInputStream;
    //   19: invokespecial 234	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   22: invokespecial 237	java/io/BufferedReader:<init>	(Ljava/io/Reader;)V
    //   25: astore_2
    //   26: aload_2
    //   27: astore_1
    //   28: aload_2
    //   29: invokevirtual 240	java/io/BufferedReader:readLine	()Ljava/lang/String;
    //   32: astore_3
    //   33: aload_3
    //   34: ifnull +13 -> 47
    //   37: aload_2
    //   38: astore_1
    //   39: aload_0
    //   40: aload_3
    //   41: invokestatic 246	java/lang/Long:parseLong	(Ljava/lang/String;)J
    //   44: putfield 55	com/radiusnetworks/bluetooth/BluetoothCrashResolver:f	J
    //   47: aload_2
    //   48: astore_1
    //   49: aload_2
    //   50: invokevirtual 240	java/io/BufferedReader:readLine	()Ljava/lang/String;
    //   53: astore_3
    //   54: aload_3
    //   55: ifnull +13 -> 68
    //   58: aload_2
    //   59: astore_1
    //   60: aload_0
    //   61: aload_3
    //   62: invokestatic 252	java/lang/Integer:parseInt	(Ljava/lang/String;)I
    //   65: putfield 57	com/radiusnetworks/bluetooth/BluetoothCrashResolver:g	I
    //   68: aload_2
    //   69: astore_1
    //   70: aload_2
    //   71: invokevirtual 240	java/io/BufferedReader:readLine	()Ljava/lang/String;
    //   74: astore_3
    //   75: aload_3
    //   76: ifnull +13 -> 89
    //   79: aload_2
    //   80: astore_1
    //   81: aload_0
    //   82: aload_3
    //   83: invokestatic 252	java/lang/Integer:parseInt	(Ljava/lang/String;)I
    //   86: putfield 59	com/radiusnetworks/bluetooth/BluetoothCrashResolver:h	I
    //   89: aload_2
    //   90: astore_1
    //   91: aload_2
    //   92: invokevirtual 240	java/io/BufferedReader:readLine	()Ljava/lang/String;
    //   95: astore_3
    //   96: aload_3
    //   97: ifnull +28 -> 125
    //   100: aload_2
    //   101: astore_1
    //   102: aload_0
    //   103: iconst_0
    //   104: putfield 61	com/radiusnetworks/bluetooth/BluetoothCrashResolver:i	Z
    //   107: aload_2
    //   108: astore_1
    //   109: aload_3
    //   110: ldc -2
    //   112: invokevirtual 258	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   115: ifeq +10 -> 125
    //   118: aload_2
    //   119: astore_1
    //   120: aload_0
    //   121: iconst_1
    //   122: putfield 61	com/radiusnetworks/bluetooth/BluetoothCrashResolver:i	Z
    //   125: aload_2
    //   126: astore_1
    //   127: aload_2
    //   128: invokevirtual 240	java/io/BufferedReader:readLine	()Ljava/lang/String;
    //   131: astore_3
    //   132: aload_3
    //   133: ifnull +75 -> 208
    //   136: aload_2
    //   137: astore_1
    //   138: aload_0
    //   139: getfield 70	com/radiusnetworks/bluetooth/BluetoothCrashResolver:m	Ljava/util/Set;
    //   142: aload_3
    //   143: invokeinterface 261 2 0
    //   148: pop
    //   149: goto -24 -> 125
    //   152: astore_1
    //   153: aload_2
    //   154: astore_1
    //   155: ldc 120
    //   157: ldc_w 263
    //   160: invokestatic 128	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;)I
    //   163: pop
    //   164: aload_2
    //   165: ifnull +7 -> 172
    //   168: aload_2
    //   169: invokevirtual 264	java/io/BufferedReader:close	()V
    //   172: aload_0
    //   173: getfield 45	com/radiusnetworks/bluetooth/BluetoothCrashResolver:a	Z
    //   176: ifeq +31 -> 207
    //   179: new 135	java/lang/StringBuilder
    //   182: dup
    //   183: ldc_w 266
    //   186: invokespecial 140	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   189: aload_0
    //   190: getfield 70	com/radiusnetworks/bluetooth/BluetoothCrashResolver:m	Ljava/util/Set;
    //   193: invokeinterface 212 1 0
    //   198: invokevirtual 182	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   201: ldc -42
    //   203: invokevirtual 172	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   206: pop
    //   207: return
    //   208: aload_2
    //   209: invokevirtual 264	java/io/BufferedReader:close	()V
    //   212: goto -40 -> 172
    //   215: astore_1
    //   216: goto -44 -> 172
    //   219: astore_1
    //   220: aconst_null
    //   221: astore_2
    //   222: aload_2
    //   223: astore_1
    //   224: ldc 120
    //   226: ldc_w 268
    //   229: invokestatic 128	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;)I
    //   232: pop
    //   233: aload_2
    //   234: ifnull -62 -> 172
    //   237: aload_2
    //   238: invokevirtual 264	java/io/BufferedReader:close	()V
    //   241: goto -69 -> 172
    //   244: astore_1
    //   245: goto -73 -> 172
    //   248: astore_3
    //   249: aload_1
    //   250: astore_2
    //   251: aload_3
    //   252: astore_1
    //   253: aload_2
    //   254: ifnull +7 -> 261
    //   257: aload_2
    //   258: invokevirtual 264	java/io/BufferedReader:close	()V
    //   261: aload_1
    //   262: athrow
    //   263: astore_1
    //   264: goto -92 -> 172
    //   267: astore_2
    //   268: goto -7 -> 261
    //   271: astore_3
    //   272: aload_1
    //   273: astore_2
    //   274: aload_3
    //   275: astore_1
    //   276: goto -23 -> 253
    //   279: astore_1
    //   280: goto -58 -> 222
    //   283: astore_1
    //   284: aconst_null
    //   285: astore_2
    //   286: goto -133 -> 153
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	289	0	this	BluetoothCrashResolver
    //   1	137	1	localObject1	Object
    //   152	1	1	localIOException1	java.io.IOException
    //   154	1	1	localObject2	Object
    //   215	1	1	localIOException2	java.io.IOException
    //   219	1	1	localNumberFormatException1	NumberFormatException
    //   223	1	1	localObject3	Object
    //   244	6	1	localIOException3	java.io.IOException
    //   252	10	1	localObject4	Object
    //   263	10	1	localIOException4	java.io.IOException
    //   275	1	1	localObject5	Object
    //   279	1	1	localNumberFormatException2	NumberFormatException
    //   283	1	1	localIOException5	java.io.IOException
    //   25	233	2	localObject6	Object
    //   267	1	2	localIOException6	java.io.IOException
    //   273	13	2	localIOException7	java.io.IOException
    //   32	111	3	str	String
    //   248	4	3	localObject7	Object
    //   271	4	3	localObject8	Object
    // Exception table:
    //   from	to	target	type
    //   28	33	152	java/io/IOException
    //   39	47	152	java/io/IOException
    //   49	54	152	java/io/IOException
    //   60	68	152	java/io/IOException
    //   70	75	152	java/io/IOException
    //   81	89	152	java/io/IOException
    //   91	96	152	java/io/IOException
    //   102	107	152	java/io/IOException
    //   109	118	152	java/io/IOException
    //   120	125	152	java/io/IOException
    //   127	132	152	java/io/IOException
    //   138	149	152	java/io/IOException
    //   208	212	215	java/io/IOException
    //   2	26	219	java/lang/NumberFormatException
    //   237	241	244	java/io/IOException
    //   2	26	248	finally
    //   168	172	263	java/io/IOException
    //   257	261	267	java/io/IOException
    //   28	33	271	finally
    //   39	47	271	finally
    //   49	54	271	finally
    //   60	68	271	finally
    //   70	75	271	finally
    //   81	89	271	finally
    //   91	96	271	finally
    //   102	107	271	finally
    //   109	118	271	finally
    //   120	125	271	finally
    //   127	132	271	finally
    //   138	149	271	finally
    //   155	164	271	finally
    //   224	233	271	finally
    //   28	33	279	java/lang/NumberFormatException
    //   39	47	279	java/lang/NumberFormatException
    //   49	54	279	java/lang/NumberFormatException
    //   60	68	279	java/lang/NumberFormatException
    //   70	75	279	java/lang/NumberFormatException
    //   81	89	279	java/lang/NumberFormatException
    //   91	96	279	java/lang/NumberFormatException
    //   102	107	279	java/lang/NumberFormatException
    //   109	118	279	java/lang/NumberFormatException
    //   120	125	279	java/lang/NumberFormatException
    //   127	132	279	java/lang/NumberFormatException
    //   138	149	279	java/lang/NumberFormatException
    //   2	26	283	java/io/IOException
  }
  
  public void crashDetected()
  {
    if (Build.VERSION.SDK_INT < 18) {
      return;
    }
    Log.w("BluetoothCrashResolver", "BluetoothService crash detected");
    if ((this.m.size() > 0) && (this.a)) {
      new StringBuilder("Distinct bluetooth devices seen at crash: ").append(this.m.size());
    }
    this.f = new Date().getTime();
    this.g += 1;
    if (this.b) {
      if (!this.a) {}
    }
    for (;;)
    {
      a();
      return;
      b();
    }
  }
  
  public void disableDebug()
  {
    this.a = false;
  }
  
  public void enableDebug()
  {
    this.a = true;
  }
  
  public void forceFlush()
  {
    b();
    a();
  }
  
  public int getDetectedCrashCount()
  {
    return this.g;
  }
  
  public long getLastBluetoothCrashDetectionTime()
  {
    return this.f;
  }
  
  public int getRecoveryAttemptCount()
  {
    return this.h;
  }
  
  public boolean isLastRecoverySucceeded()
  {
    return this.i;
  }
  
  public boolean isRecoveryInProgress()
  {
    return this.b;
  }
  
  @TargetApi(18)
  public void notifyScannedDevice(BluetoothDevice paramBluetoothDevice, BluetoothAdapter.LeScanCallback paramLeScanCallback)
  {
    int i1 = 0;
    if (this.a) {
      i1 = this.m.size();
    }
    synchronized (this.m)
    {
      this.m.add(paramBluetoothDevice.getAddress());
      if (this.a)
      {
        int i2 = this.m.size();
        if ((i1 != i2) && (i2 % 100 == 0) && (this.a)) {
          new StringBuilder("Distinct bluetooth devices seen: ").append(this.m.size());
        }
      }
      if ((this.m.size() > 1590) && (!this.b))
      {
        Log.w("BluetoothCrashResolver", "Large number of bluetooth devices detected: " + this.m.size() + " Proactively attempting to clear out address list to prevent a crash");
        Log.w("BluetoothCrashResolver", "Stopping LE Scan");
        BluetoothAdapter.getDefaultAdapter().stopLeScan(paramLeScanCallback);
        b();
        a();
      }
      return;
    }
  }
  
  public void setUpdateNotifier(UpdateNotifier paramUpdateNotifier)
  {
    this.l = paramUpdateNotifier;
  }
  
  public void start()
  {
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("android.bluetooth.adapter.action.STATE_CHANGED");
    localIntentFilter.addAction("android.bluetooth.adapter.action.DISCOVERY_STARTED");
    localIntentFilter.addAction("android.bluetooth.adapter.action.DISCOVERY_FINISHED");
    this.k.registerReceiver(this.o, localIntentFilter);
  }
  
  public void stop()
  {
    this.k.unregisterReceiver(this.o);
    c();
  }
  
  public static abstract interface UpdateNotifier
  {
    public abstract void dataUpdated();
  }
  
  final class a
    extends AsyncTask<Void, Void, Void>
  {
    private a() {}
    
    protected final Void a()
    {
      try
      {
        Thread.sleep(5000L);
        if (!BluetoothCrashResolver.g(BluetoothCrashResolver.this)) {
          Log.w("BluetoothCrashResolver", "BluetoothAdapter.ACTION_DISCOVERY_STARTED never received.  Recovery may fail.");
        }
        BluetoothAdapter localBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        if (localBluetoothAdapter.isDiscovering()) {
          localBluetoothAdapter.cancelDiscovery();
        }
      }
      catch (InterruptedException localInterruptedException)
      {
        for (;;) {}
      }
      return null;
    }
    
    protected final void onPreExecute() {}
  }
}


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