b.java 17.8 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
package com.instabug.library.internal.a;

import android.app.ActivityManager;
import android.app.ActivityManager.MemoryInfo;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Environment;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import com.instabug.library.Feature;
import com.instabug.library.Feature.State;
import com.instabug.library.InstabugFeaturesManager;
import com.instabug.library.R.bool;
import com.instabug.library.u;
import com.instabug.library.util.InstabugSDKLogger;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Locale;
import java.util.UUID;
import sa;

public class b
{
  private boolean a = false;
  private String b = "";
  private String c = null;
  private String d = "";
  private String e = "";
  private String f = "";
  private String g = null;
  private String h = "Unknown";
  private String i = "Unknown";
  private String j = null;
  private String k;
  private String l;
  private String m;
  private String n;
  private String o;
  
  public b(Context paramContext)
  {
    try
    {
      this.a = paramContext.getResources().getBoolean(R.bool.isTablet);
      if (paramContext.getResources().getConfiguration().orientation == 2)
      {
        this.b = "landscape";
        this.f = paramContext.getResources().getConfiguration().locale.toString();
        if (this.g == null) {
          localObject1 = new PackageInfo();
        }
      }
    }
    catch (Exception localException3)
    {
      try
      {
        localObject2 = paramContext.getPackageManager().getPackageInfo(paramContext.getPackageName(), 0);
        localObject1 = localObject2;
        this.g = String.format("%s (%s)", new Object[] { ((PackageInfo)localObject1).versionName, Integer.valueOf(((PackageInfo)localObject1).versionCode) });
      }
      catch (PackageManager.NameNotFoundException localException3)
      {
        try
        {
          for (;;)
          {
            Object localObject2;
            Object localObject1 = paramContext.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
            i1 = ((Intent)localObject1).getIntExtra("level", -1);
            int i2 = ((Intent)localObject1).getIntExtra("scale", -1);
            float f1 = i1 / i2;
            this.h = ((int)(f1 * 100.0F) + "%");
            try
            {
              localObject1 = paramContext.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
              i1 = ((Intent)localObject1).getIntExtra("status", -1);
              if (i1 == 2) {
                break label898;
              }
              if (i1 != 5) {
                break label692;
              }
            }
            catch (Exception localException5)
            {
              label284:
              for (;;) {}
            }
            i3 = ((Intent)localObject1).getIntExtra("plugged", -1);
            if (i3 == 2)
            {
              i2 = 1;
              break label903;
              label306:
              if (i1 == 0) {
                break label722;
              }
              localObject2 = new StringBuilder("Charging");
              if (i3 == 0) {
                break label709;
              }
              localObject1 = " through AC Charger";
              label330:
              localObject1 = (String)localObject1;
              label342:
              this.i = ((String)localObject1);
              localObject1 = ((WindowManager)paramContext.getSystemService("window")).getDefaultDisplay();
              localObject2 = new DisplayMetrics();
              ((Display)localObject1).getMetrics((DisplayMetrics)localObject2);
              if (Build.VERSION.SDK_INT >= 17) {
                ((Display)localObject1).getRealMetrics((DisplayMetrics)localObject2);
              }
              this.e = String.format("%sx%s", new Object[] { Integer.valueOf(((DisplayMetrics)localObject2).widthPixels), Integer.valueOf(((DisplayMetrics)localObject2).heightPixels) });
              if (((DisplayMetrics)localObject2).densityDpi >= 160) {
                break label730;
              }
              this.d = "ldpi";
              label447:
              if (this.c != null) {}
            }
            try
            {
              this.c = paramContext.getApplicationInfo().packageName;
              label465:
              if (this.j == null)
              {
                this.j = u.a().E();
                if (this.j == null)
                {
                  this.j = UUID.randomUUID().toString();
                  u.a().f(this.j);
                }
              }
              localObject1 = (ActivityManager)paramContext.getSystemService("activity");
              localObject2 = new ActivityManager.MemoryInfo();
              ((ActivityManager)localObject1).getMemoryInfo((ActivityManager.MemoryInfo)localObject2);
              this.k = a.a(((ActivityManager.MemoryInfo)localObject2).availMem);
            }
            catch (Exception localException3)
            {
              try
              {
                this.l = ((TelephonyManager)paramContext.getSystemService("phone")).getNetworkOperatorName();
              }
              catch (Exception localException3)
              {
                try
                {
                  boolean bool = ((ConnectivityManager)paramContext.getSystemService("connectivity")).getNetworkInfo(1).isConnected();
                  if (!bool) {
                    break label878;
                  }
                }
                catch (Exception localException4)
                {
                  for (;;)
                  {
                    label609:
                    label692:
                    label709:
                    label722:
                    label730:
                    this.m = "Could not get information";
                    continue;
                    this.m = "Not Connected";
                  }
                }
                try
                {
                  this.m = ((WifiManager)paramContext.getSystemService("wifi")).getConnectionInfo().getSSID();
                  localObject1 = (ActivityManager)paramContext.getSystemService("activity");
                  localObject2 = new ActivityManager.MemoryInfo();
                  ((ActivityManager)localObject1).getMemoryInfo((ActivityManager.MemoryInfo)localObject2);
                  this.o = a.a(a(paramContext) - ((ActivityManager.MemoryInfo)localObject2).availMem);
                  a.a(a(paramContext));
                  return;
                  localException1 = localException1;
                  this.a = false;
                  continue;
                  this.b = "portrait";
                  continue;
                  localNameNotFoundException = localNameNotFoundException;
                  localNameNotFoundException.printStackTrace();
                  continue;
                  i1 = 0;
                  break label284;
                  i2 = 0;
                  break label903;
                  i3 = 0;
                  break label306;
                  if (i2 != 0)
                  {
                    String str1 = " through USB cable";
                    break label330;
                    str1 = "Unplugged";
                    break label342;
                    if (localNameNotFoundException.densityDpi < 240)
                    {
                      this.d = "mdpi";
                      break label447;
                    }
                    if (localNameNotFoundException.densityDpi < 320)
                    {
                      this.d = "hdpi";
                      break label447;
                    }
                    if (localNameNotFoundException.densityDpi < 480)
                    {
                      this.d = "xhdpi";
                      break label447;
                    }
                    if (localNameNotFoundException.densityDpi < 640)
                    {
                      this.d = "xxhdpi";
                      break label447;
                    }
                    this.d = "xxxhdpi";
                    break label447;
                    localException2 = localException2;
                    this.c = "Could not get information";
                    break label465;
                    localException3 = localException3;
                    this.l = "Unknown";
                  }
                }
                catch (SecurityException localSecurityException)
                {
                  InstabugSDKLogger.d(this, "Could not read wifi SSID. To enable please add the following line in your AndroidManifest.xml <uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>");
                  this.m = "Connected";
                  break label609;
                }
              }
            }
          }
        }
        catch (Exception localException6)
        {
          for (;;)
          {
            int i3;
            label878:
            continue;
            label898:
            int i1 = 1;
            continue;
            label903:
            if (i3 == 1)
            {
              i3 = 1;
              continue;
              String str2 = "";
            }
          }
        }
      }
    }
  }
  
  private static long a(Context paramContext)
  {
    if (Build.VERSION.SDK_INT >= 16)
    {
      paramContext = (ActivityManager)paramContext.getSystemService("activity");
      ActivityManager.MemoryInfo localMemoryInfo = new ActivityManager.MemoryInfo();
      paramContext.getMemoryInfo(localMemoryInfo);
      return localMemoryInfo.totalMem;
    }
    return v();
  }
  
  /* Error */
  private static long v()
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: new 352	java/io/RandomAccessFile
    //   5: dup
    //   6: ldc_w 354
    //   9: ldc_w 356
    //   12: invokespecial 359	java/io/RandomAccessFile:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   15: astore_3
    //   16: aload_3
    //   17: invokevirtual 362	java/io/RandomAccessFile:readLine	()Ljava/lang/String;
    //   20: ldc_w 364
    //   23: invokevirtual 368	java/lang/String:split	(Ljava/lang/String;)[Ljava/lang/String;
    //   26: iconst_1
    //   27: aaload
    //   28: invokevirtual 371	java/lang/String:trim	()Ljava/lang/String;
    //   31: astore_2
    //   32: aload_2
    //   33: iconst_0
    //   34: aload_2
    //   35: invokevirtual 375	java/lang/String:length	()I
    //   38: iconst_3
    //   39: isub
    //   40: invokevirtual 379	java/lang/String:substring	(II)Ljava/lang/String;
    //   43: invokevirtual 371	java/lang/String:trim	()Ljava/lang/String;
    //   46: astore_2
    //   47: aload_3
    //   48: invokevirtual 382	java/io/RandomAccessFile:close	()V
    //   51: aload_2
    //   52: invokestatic 388	java/lang/Long:parseLong	(Ljava/lang/String;)J
    //   55: lstore_0
    //   56: lload_0
    //   57: ldc2_w 389
    //   60: lmul
    //   61: lstore_0
    //   62: aload_3
    //   63: invokevirtual 382	java/io/RandomAccessFile:close	()V
    //   66: lload_0
    //   67: lreturn
    //   68: astore_2
    //   69: aload_2
    //   70: invokevirtual 391	java/io/IOException:printStackTrace	()V
    //   73: lload_0
    //   74: lreturn
    //   75: astore_3
    //   76: aload_3
    //   77: invokevirtual 391	java/io/IOException:printStackTrace	()V
    //   80: aload_2
    //   81: ifnull +7 -> 88
    //   84: aload_2
    //   85: invokevirtual 382	java/io/RandomAccessFile:close	()V
    //   88: lconst_0
    //   89: lreturn
    //   90: astore_2
    //   91: aload_2
    //   92: invokevirtual 391	java/io/IOException:printStackTrace	()V
    //   95: goto -7 -> 88
    //   98: astore_2
    //   99: aconst_null
    //   100: astore_3
    //   101: aload_3
    //   102: ifnull +7 -> 109
    //   105: aload_3
    //   106: invokevirtual 382	java/io/RandomAccessFile:close	()V
    //   109: aload_2
    //   110: athrow
    //   111: astore_3
    //   112: aload_3
    //   113: invokevirtual 391	java/io/IOException:printStackTrace	()V
    //   116: goto -7 -> 109
    //   119: astore_2
    //   120: goto -19 -> 101
    //   123: astore 4
    //   125: aload_2
    //   126: astore_3
    //   127: aload 4
    //   129: astore_2
    //   130: goto -29 -> 101
    //   133: astore 4
    //   135: aload_3
    //   136: astore_2
    //   137: aload 4
    //   139: astore_3
    //   140: goto -64 -> 76
    // Local variable table:
    //   start	length	slot	name	signature
    //   55	19	0	l1	long
    //   1	51	2	str	String
    //   68	17	2	localIOException1	IOException
    //   90	2	2	localIOException2	IOException
    //   98	12	2	localObject1	Object
    //   119	7	2	localObject2	Object
    //   129	8	2	localObject3	Object
    //   15	48	3	localRandomAccessFile	java.io.RandomAccessFile
    //   75	2	3	localIOException3	IOException
    //   100	6	3	localObject4	Object
    //   111	2	3	localIOException4	IOException
    //   126	14	3	localObject5	Object
    //   123	5	4	localObject6	Object
    //   133	5	4	localIOException5	IOException
    // Exception table:
    //   from	to	target	type
    //   62	66	68	java/io/IOException
    //   2	16	75	java/io/IOException
    //   84	88	90	java/io/IOException
    //   2	16	98	finally
    //   105	109	111	java/io/IOException
    //   16	56	119	finally
    //   76	80	123	finally
    //   16	56	133	java/io/IOException
  }
  
  public String a()
  {
    return Build.MANUFACTURER + " " + Build.MODEL;
  }
  
  public int b()
  {
    return Build.VERSION.SDK_INT;
  }
  
  public String c()
  {
    return this.b;
  }
  
  public String d()
  {
    return this.d;
  }
  
  public String e()
  {
    return this.e;
  }
  
  public String f()
  {
    try
    {
      if (sa.a()) {
        return "Rooted";
      }
    }
    catch (Exception localException)
    {
      InstabugSDKLogger.w(this, "Something went wrong while checking if device is rooted or not " + localException.getMessage());
    }
    return "Not rooted";
  }
  
  public String g()
  {
    return this.h;
  }
  
  public String h()
  {
    return this.i;
  }
  
  public String i()
  {
    return this.l;
  }
  
  public String j()
  {
    return this.g;
  }
  
  public String k()
  {
    return this.c;
  }
  
  public String l()
  {
    return this.j;
  }
  
  public String m()
  {
    return this.m;
  }
  
  public String n()
  {
    StringBuilder localStringBuilder;
    ArrayList localArrayList;
    int i1;
    if (InstabugFeaturesManager.getInstance().getFeatureState(Feature.CONSOLE_LOGS) == Feature.State.ENABLED)
    {
      try
      {
        BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("logcat -v time -d " + android.os.Process.myPid()).getInputStream()));
        localStringBuilder = new StringBuilder();
        localArrayList = new ArrayList();
        for (;;)
        {
          String str2 = localBufferedReader.readLine();
          if (str2 == null) {
            break;
          }
          localArrayList.add(str2);
        }
        localIOException.close();
      }
      catch (IOException localIOException)
      {
        InstabugSDKLogger.e(this, "Could not read logcat log", localIOException);
        return "Error in reading Log File";
      }
      localArrayList.trimToSize();
      if (localArrayList.size() <= 700) {
        break label193;
      }
      i1 = localArrayList.size() - 700;
    }
    for (;;)
    {
      if (i1 < localArrayList.size())
      {
        localStringBuilder.append((String)localArrayList.get(i1));
        localStringBuilder.append("\n");
        i1 += 1;
      }
      else
      {
        localArrayList.clear();
        String str1 = localStringBuilder.toString();
        return str1;
        return "";
        label193:
        i1 = 0;
      }
    }
  }
  
  public String o()
  {
    return this.o;
  }
  
  public String p()
  {
    return this.n;
  }
  
  public String q()
  {
    return this.k;
  }
  
  public String r()
  {
    if (a.a()) {
      return a.a(Environment.getExternalStorageDirectory().getTotalSpace() - Environment.getExternalStorageDirectory().getFreeSpace());
    }
    return "Unavailable";
  }
  
  public String s()
  {
    if (a.a()) {
      return a.a(Environment.getExternalStorageDirectory().getUsableSpace());
    }
    return "Unavailable";
  }
  
  public String t()
  {
    if (a.a()) {
      return a.a(Environment.getExternalStorageDirectory().getTotalSpace());
    }
    return "Unavailable";
  }
  
  public String u()
  {
    return this.f;
  }
  
  static final class a
  {
    public static String a(long paramLong)
    {
      if (paramLong == 0L) {
        return "Unavailable";
      }
      String str = null;
      long l = paramLong;
      if (paramLong >= 1024L)
      {
        l = paramLong / 1024L;
        if (paramLong < 1024L) {
          break label78;
        }
        l /= 1024L;
      }
      label78:
      for (str = " MB";; str = " KB")
      {
        StringBuilder localStringBuilder = new StringBuilder(Long.toString(l));
        if (str != null) {
          localStringBuilder.append(str);
        }
        return localStringBuilder.toString();
      }
    }
    
    public static boolean a()
    {
      return Environment.getExternalStorageState().equals("mounted");
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/instabug/library/internal/a/b.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */