AndroidPlatform$CloseGuard.smali 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. .class final Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/EnclosingClass;
  6. value = Lokhttp3/internal/platform/AndroidPlatform;
  7. .end annotation
  8. .annotation system Ldalvik/annotation/InnerClass;
  9. accessFlags = 0x18
  10. name = "CloseGuard"
  11. .end annotation
  12. # instance fields
  13. .field private final getMethod:Ljava/lang/reflect/Method;
  14. .field private final openMethod:Ljava/lang/reflect/Method;
  15. .field private final warnIfOpenMethod:Ljava/lang/reflect/Method;
  16. # direct methods
  17. .method constructor <init>(Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;)V
  18. .locals 0
  19. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  20. iput-object p1, p0, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;->getMethod:Ljava/lang/reflect/Method;
  21. iput-object p2, p0, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;->openMethod:Ljava/lang/reflect/Method;
  22. iput-object p3, p0, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;->warnIfOpenMethod:Ljava/lang/reflect/Method;
  23. return-void
  24. .end method
  25. .method static get()Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;
  26. .locals 7
  27. const-string v0, "dalvik.system.CloseGuard"
  28. const/4 v1, 0x0
  29. :try_start_0
  30. invoke-static {v0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
  31. move-result-object v0
  32. const-string v2, "get"
  33. const/4 v3, 0x0
  34. new-array v4, v3, [Ljava/lang/Class;
  35. invoke-virtual {v0, v2, v4}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  36. move-result-object v2
  37. const-string v4, "open"
  38. const/4 v5, 0x1
  39. new-array v5, v5, [Ljava/lang/Class;
  40. const-class v6, Ljava/lang/String;
  41. aput-object v6, v5, v3
  42. invoke-virtual {v0, v4, v5}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  43. move-result-object v4
  44. const-string v5, "warnIfOpen"
  45. new-array v3, v3, [Ljava/lang/Class;
  46. invoke-virtual {v0, v5, v3}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  47. move-result-object v1
  48. :try_end_0
  49. .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
  50. move-object v0, v1
  51. move-object v1, v2
  52. goto :goto_0
  53. :catch_0
  54. move-object v0, v1
  55. move-object v4, v0
  56. :goto_0
  57. new-instance v2, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;
  58. invoke-direct {v2, v1, v4, v0}, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;-><init>(Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;)V
  59. return-object v2
  60. .end method
  61. # virtual methods
  62. .method createAndOpen(Ljava/lang/String;)Ljava/lang/Object;
  63. .locals 5
  64. iget-object v0, p0, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;->getMethod:Ljava/lang/reflect/Method;
  65. const/4 v1, 0x0
  66. if-eqz v0, :cond_0
  67. const/4 v2, 0x0
  68. :try_start_0
  69. new-array v3, v2, [Ljava/lang/Object;
  70. invoke-virtual {v0, v1, v3}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  71. move-result-object v0
  72. iget-object v3, p0, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;->openMethod:Ljava/lang/reflect/Method;
  73. const/4 v4, 0x1
  74. new-array v4, v4, [Ljava/lang/Object;
  75. aput-object p1, v4, v2
  76. invoke-virtual {v3, v0, v4}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  77. :try_end_0
  78. .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
  79. return-object v0
  80. :catch_0
  81. :cond_0
  82. return-object v1
  83. .end method
  84. .method warnIfOpen(Ljava/lang/Object;)Z
  85. .locals 3
  86. const/4 v0, 0x0
  87. if-eqz p1, :cond_0
  88. :try_start_0
  89. iget-object v1, p0, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;->warnIfOpenMethod:Ljava/lang/reflect/Method;
  90. new-array v2, v0, [Ljava/lang/Object;
  91. invoke-virtual {v1, p1, v2}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  92. :try_end_0
  93. .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
  94. const/4 v0, 0x1
  95. :catch_0
  96. :cond_0
  97. return v0
  98. .end method