AndroidPlatform.smali 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  1. .class Lokhttp3/internal/platform/AndroidPlatform;
  2. .super Lokhttp3/internal/platform/Platform;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/MemberClasses;
  6. value = {
  7. Lokhttp3/internal/platform/AndroidPlatform$AndroidTrustRootIndex;,
  8. Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;,
  9. Lokhttp3/internal/platform/AndroidPlatform$AndroidCertificateChainCleaner;
  10. }
  11. .end annotation
  12. # static fields
  13. .field private static final MAX_LOG_LENGTH:I = 0xfa0
  14. # instance fields
  15. .field private final closeGuard:Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;
  16. .field private final getAlpnSelectedProtocol:Lokhttp3/internal/platform/OptionalMethod;
  17. .annotation system Ldalvik/annotation/Signature;
  18. value = {
  19. "Lokhttp3/internal/platform/OptionalMethod<",
  20. "Ljava/net/Socket;",
  21. ">;"
  22. }
  23. .end annotation
  24. .end field
  25. .field private final setAlpnProtocols:Lokhttp3/internal/platform/OptionalMethod;
  26. .annotation system Ldalvik/annotation/Signature;
  27. value = {
  28. "Lokhttp3/internal/platform/OptionalMethod<",
  29. "Ljava/net/Socket;",
  30. ">;"
  31. }
  32. .end annotation
  33. .end field
  34. .field private final setHostname:Lokhttp3/internal/platform/OptionalMethod;
  35. .annotation system Ldalvik/annotation/Signature;
  36. value = {
  37. "Lokhttp3/internal/platform/OptionalMethod<",
  38. "Ljava/net/Socket;",
  39. ">;"
  40. }
  41. .end annotation
  42. .end field
  43. .field private final setUseSessionTickets:Lokhttp3/internal/platform/OptionalMethod;
  44. .annotation system Ldalvik/annotation/Signature;
  45. value = {
  46. "Lokhttp3/internal/platform/OptionalMethod<",
  47. "Ljava/net/Socket;",
  48. ">;"
  49. }
  50. .end annotation
  51. .end field
  52. .field private final sslParametersClass:Ljava/lang/Class;
  53. .annotation system Ldalvik/annotation/Signature;
  54. value = {
  55. "Ljava/lang/Class<",
  56. "*>;"
  57. }
  58. .end annotation
  59. .end field
  60. # direct methods
  61. .method constructor <init>(Ljava/lang/Class;Lokhttp3/internal/platform/OptionalMethod;Lokhttp3/internal/platform/OptionalMethod;Lokhttp3/internal/platform/OptionalMethod;Lokhttp3/internal/platform/OptionalMethod;)V
  62. .locals 1
  63. .annotation system Ldalvik/annotation/Signature;
  64. value = {
  65. "(",
  66. "Ljava/lang/Class<",
  67. "*>;",
  68. "Lokhttp3/internal/platform/OptionalMethod<",
  69. "Ljava/net/Socket;",
  70. ">;",
  71. "Lokhttp3/internal/platform/OptionalMethod<",
  72. "Ljava/net/Socket;",
  73. ">;",
  74. "Lokhttp3/internal/platform/OptionalMethod<",
  75. "Ljava/net/Socket;",
  76. ">;",
  77. "Lokhttp3/internal/platform/OptionalMethod<",
  78. "Ljava/net/Socket;",
  79. ">;)V"
  80. }
  81. .end annotation
  82. invoke-direct {p0}, Lokhttp3/internal/platform/Platform;-><init>()V
  83. invoke-static {}, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;->get()Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;
  84. move-result-object v0
  85. iput-object v0, p0, Lokhttp3/internal/platform/AndroidPlatform;->closeGuard:Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;
  86. iput-object p1, p0, Lokhttp3/internal/platform/AndroidPlatform;->sslParametersClass:Ljava/lang/Class;
  87. iput-object p2, p0, Lokhttp3/internal/platform/AndroidPlatform;->setUseSessionTickets:Lokhttp3/internal/platform/OptionalMethod;
  88. iput-object p3, p0, Lokhttp3/internal/platform/AndroidPlatform;->setHostname:Lokhttp3/internal/platform/OptionalMethod;
  89. iput-object p4, p0, Lokhttp3/internal/platform/AndroidPlatform;->getAlpnSelectedProtocol:Lokhttp3/internal/platform/OptionalMethod;
  90. iput-object p5, p0, Lokhttp3/internal/platform/AndroidPlatform;->setAlpnProtocols:Lokhttp3/internal/platform/OptionalMethod;
  91. return-void
  92. .end method
  93. .method private api23IsCleartextTrafficPermitted(Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Object;)Z
  94. .locals 3
  95. .annotation system Ldalvik/annotation/Signature;
  96. value = {
  97. "(",
  98. "Ljava/lang/String;",
  99. "Ljava/lang/Class<",
  100. "*>;",
  101. "Ljava/lang/Object;",
  102. ")Z"
  103. }
  104. .end annotation
  105. .annotation system Ldalvik/annotation/Throws;
  106. value = {
  107. Ljava/lang/reflect/InvocationTargetException;,
  108. Ljava/lang/IllegalAccessException;
  109. }
  110. .end annotation
  111. :try_start_0
  112. const-string v0, "isCleartextTrafficPermitted"
  113. const/4 v1, 0x0
  114. new-array v2, v1, [Ljava/lang/Class;
  115. invoke-virtual {p2, v0, v2}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  116. move-result-object p2
  117. new-array v0, v1, [Ljava/lang/Object;
  118. invoke-virtual {p2, p3, v0}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  119. move-result-object p2
  120. check-cast p2, Ljava/lang/Boolean;
  121. invoke-virtual {p2}, Ljava/lang/Boolean;->booleanValue()Z
  122. move-result p1
  123. :try_end_0
  124. .catch Ljava/lang/NoSuchMethodException; {:try_start_0 .. :try_end_0} :catch_0
  125. return p1
  126. :catch_0
  127. invoke-super {p0, p1}, Lokhttp3/internal/platform/Platform;->isCleartextTrafficPermitted(Ljava/lang/String;)Z
  128. move-result p1
  129. return p1
  130. .end method
  131. .method private api24IsCleartextTrafficPermitted(Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Object;)Z
  132. .locals 5
  133. .annotation system Ldalvik/annotation/Signature;
  134. value = {
  135. "(",
  136. "Ljava/lang/String;",
  137. "Ljava/lang/Class<",
  138. "*>;",
  139. "Ljava/lang/Object;",
  140. ")Z"
  141. }
  142. .end annotation
  143. .annotation system Ldalvik/annotation/Throws;
  144. value = {
  145. Ljava/lang/reflect/InvocationTargetException;,
  146. Ljava/lang/IllegalAccessException;
  147. }
  148. .end annotation
  149. :try_start_0
  150. const-string v0, "isCleartextTrafficPermitted"
  151. const/4 v1, 0x1
  152. new-array v2, v1, [Ljava/lang/Class;
  153. const-class v3, Ljava/lang/String;
  154. const/4 v4, 0x0
  155. aput-object v3, v2, v4
  156. invoke-virtual {p2, v0, v2}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  157. move-result-object v0
  158. new-array v1, v1, [Ljava/lang/Object;
  159. aput-object p1, v1, v4
  160. invoke-virtual {v0, p3, v1}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  161. move-result-object v0
  162. check-cast v0, Ljava/lang/Boolean;
  163. invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z
  164. move-result p1
  165. :try_end_0
  166. .catch Ljava/lang/NoSuchMethodException; {:try_start_0 .. :try_end_0} :catch_0
  167. return p1
  168. :catch_0
  169. invoke-direct {p0, p1, p2, p3}, Lokhttp3/internal/platform/AndroidPlatform;->api23IsCleartextTrafficPermitted(Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Object;)Z
  170. move-result p1
  171. return p1
  172. .end method
  173. .method public static buildIfSupported()Lokhttp3/internal/platform/Platform;
  174. .locals 10
  175. const-class v0, [B
  176. const-string v1, "com.android.org.conscrypt.SSLParametersImpl"
  177. const/4 v2, 0x0
  178. :try_start_0
  179. invoke-static {v1}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
  180. move-result-object v1
  181. :try_end_0
  182. .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
  183. :goto_0
  184. move-object v4, v1
  185. goto :goto_1
  186. :catch_0
  187. const-string v1, "org.apache.harmony.xnet.provider.jsse.SSLParametersImpl"
  188. :try_start_1
  189. invoke-static {v1}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
  190. move-result-object v1
  191. goto :goto_0
  192. :goto_1
  193. new-instance v5, Lokhttp3/internal/platform/OptionalMethod;
  194. const-string v1, "setUseSessionTickets"
  195. const/4 v3, 0x1
  196. new-array v6, v3, [Ljava/lang/Class;
  197. sget-object v7, Ljava/lang/Boolean;->TYPE:Ljava/lang/Class;
  198. const/4 v8, 0x0
  199. aput-object v7, v6, v8
  200. invoke-direct {v5, v2, v1, v6}, Lokhttp3/internal/platform/OptionalMethod;-><init>(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)V
  201. new-instance v6, Lokhttp3/internal/platform/OptionalMethod;
  202. const-string v1, "setHostname"
  203. new-array v7, v3, [Ljava/lang/Class;
  204. const-class v9, Ljava/lang/String;
  205. aput-object v9, v7, v8
  206. invoke-direct {v6, v2, v1, v7}, Lokhttp3/internal/platform/OptionalMethod;-><init>(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)V
  207. invoke-static {}, Lokhttp3/internal/platform/AndroidPlatform;->supportsAlpn()Z
  208. move-result v1
  209. if-eqz v1, :cond_0
  210. new-instance v1, Lokhttp3/internal/platform/OptionalMethod;
  211. const-string v7, "getAlpnSelectedProtocol"
  212. new-array v9, v8, [Ljava/lang/Class;
  213. invoke-direct {v1, v0, v7, v9}, Lokhttp3/internal/platform/OptionalMethod;-><init>(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)V
  214. new-instance v7, Lokhttp3/internal/platform/OptionalMethod;
  215. const-string v9, "setAlpnProtocols"
  216. new-array v3, v3, [Ljava/lang/Class;
  217. aput-object v0, v3, v8
  218. invoke-direct {v7, v2, v9, v3}, Lokhttp3/internal/platform/OptionalMethod;-><init>(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)V
  219. move-object v8, v7
  220. move-object v7, v1
  221. goto :goto_2
  222. :cond_0
  223. move-object v7, v2
  224. move-object v8, v7
  225. :goto_2
  226. new-instance v0, Lokhttp3/internal/platform/AndroidPlatform;
  227. move-object v3, v0
  228. invoke-direct/range {v3 .. v8}, Lokhttp3/internal/platform/AndroidPlatform;-><init>(Ljava/lang/Class;Lokhttp3/internal/platform/OptionalMethod;Lokhttp3/internal/platform/OptionalMethod;Lokhttp3/internal/platform/OptionalMethod;Lokhttp3/internal/platform/OptionalMethod;)V
  229. :try_end_1
  230. .catch Ljava/lang/ClassNotFoundException; {:try_start_1 .. :try_end_1} :catch_1
  231. return-object v0
  232. :catch_1
  233. return-object v2
  234. .end method
  235. .method private static supportsAlpn()Z
  236. .locals 2
  237. const-string v0, "GMSCore_OpenSSL"
  238. invoke-static {v0}, Ljava/security/Security;->getProvider(Ljava/lang/String;)Ljava/security/Provider;
  239. move-result-object v0
  240. const/4 v1, 0x1
  241. if-eqz v0, :cond_0
  242. return v1
  243. :cond_0
  244. const-string v0, "android.net.Network"
  245. :try_start_0
  246. invoke-static {v0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
  247. :try_end_0
  248. .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
  249. return v1
  250. :catch_0
  251. const/4 v0, 0x0
  252. return v0
  253. .end method
  254. # virtual methods
  255. .method public buildCertificateChainCleaner(Ljavax/net/ssl/X509TrustManager;)Lokhttp3/internal/tls/CertificateChainCleaner;
  256. .locals 7
  257. const-string v0, "android.net.http.X509TrustManagerExtensions"
  258. :try_start_0
  259. invoke-static {v0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
  260. move-result-object v0
  261. const/4 v1, 0x1
  262. new-array v2, v1, [Ljava/lang/Class;
  263. const-class v3, Ljavax/net/ssl/X509TrustManager;
  264. const/4 v4, 0x0
  265. aput-object v3, v2, v4
  266. invoke-virtual {v0, v2}, Ljava/lang/Class;->getConstructor([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;
  267. move-result-object v2
  268. new-array v3, v1, [Ljava/lang/Object;
  269. aput-object p1, v3, v4
  270. invoke-virtual {v2, v3}, Ljava/lang/reflect/Constructor;->newInstance([Ljava/lang/Object;)Ljava/lang/Object;
  271. move-result-object v2
  272. const-string v3, "checkServerTrusted"
  273. const/4 v5, 0x3
  274. new-array v5, v5, [Ljava/lang/Class;
  275. const-class v6, [Ljava/security/cert/X509Certificate;
  276. aput-object v6, v5, v4
  277. const-class v4, Ljava/lang/String;
  278. aput-object v4, v5, v1
  279. const/4 v1, 0x2
  280. const-class v4, Ljava/lang/String;
  281. aput-object v4, v5, v1
  282. invoke-virtual {v0, v3, v5}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  283. move-result-object v0
  284. new-instance v1, Lokhttp3/internal/platform/AndroidPlatform$AndroidCertificateChainCleaner;
  285. invoke-direct {v1, v2, v0}, Lokhttp3/internal/platform/AndroidPlatform$AndroidCertificateChainCleaner;-><init>(Ljava/lang/Object;Ljava/lang/reflect/Method;)V
  286. :try_end_0
  287. .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
  288. return-object v1
  289. :catch_0
  290. invoke-super {p0, p1}, Lokhttp3/internal/platform/Platform;->buildCertificateChainCleaner(Ljavax/net/ssl/X509TrustManager;)Lokhttp3/internal/tls/CertificateChainCleaner;
  291. move-result-object p1
  292. return-object p1
  293. .end method
  294. .method public buildTrustRootIndex(Ljavax/net/ssl/X509TrustManager;)Lokhttp3/internal/tls/TrustRootIndex;
  295. .locals 6
  296. :try_start_0
  297. invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
  298. move-result-object v0
  299. const-string v1, "findTrustAnchorByIssuerAndSignature"
  300. const/4 v2, 0x1
  301. new-array v3, v2, [Ljava/lang/Class;
  302. const/4 v4, 0x0
  303. const-class v5, Ljava/security/cert/X509Certificate;
  304. aput-object v5, v3, v4
  305. invoke-virtual {v0, v1, v3}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  306. move-result-object v0
  307. invoke-virtual {v0, v2}, Ljava/lang/reflect/Method;->setAccessible(Z)V
  308. new-instance v1, Lokhttp3/internal/platform/AndroidPlatform$AndroidTrustRootIndex;
  309. invoke-direct {v1, p1, v0}, Lokhttp3/internal/platform/AndroidPlatform$AndroidTrustRootIndex;-><init>(Ljavax/net/ssl/X509TrustManager;Ljava/lang/reflect/Method;)V
  310. :try_end_0
  311. .catch Ljava/lang/NoSuchMethodException; {:try_start_0 .. :try_end_0} :catch_0
  312. return-object v1
  313. :catch_0
  314. invoke-super {p0, p1}, Lokhttp3/internal/platform/Platform;->buildTrustRootIndex(Ljavax/net/ssl/X509TrustManager;)Lokhttp3/internal/tls/TrustRootIndex;
  315. move-result-object p1
  316. return-object p1
  317. .end method
  318. .method public configureTlsExtensions(Ljavax/net/ssl/SSLSocket;Ljava/lang/String;Ljava/util/List;)V
  319. .locals 5
  320. .annotation system Ldalvik/annotation/Signature;
  321. value = {
  322. "(",
  323. "Ljavax/net/ssl/SSLSocket;",
  324. "Ljava/lang/String;",
  325. "Ljava/util/List<",
  326. "Lokhttp3/Protocol;",
  327. ">;)V"
  328. }
  329. .end annotation
  330. const/4 v0, 0x0
  331. const/4 v1, 0x1
  332. if-eqz p2, :cond_0
  333. iget-object v2, p0, Lokhttp3/internal/platform/AndroidPlatform;->setUseSessionTickets:Lokhttp3/internal/platform/OptionalMethod;
  334. new-array v3, v1, [Ljava/lang/Object;
  335. invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
  336. move-result-object v4
  337. aput-object v4, v3, v0
  338. invoke-virtual {v2, p1, v3}, Lokhttp3/internal/platform/OptionalMethod;->invokeOptionalWithoutCheckedException(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  339. iget-object v2, p0, Lokhttp3/internal/platform/AndroidPlatform;->setHostname:Lokhttp3/internal/platform/OptionalMethod;
  340. new-array v3, v1, [Ljava/lang/Object;
  341. aput-object p2, v3, v0
  342. invoke-virtual {v2, p1, v3}, Lokhttp3/internal/platform/OptionalMethod;->invokeOptionalWithoutCheckedException(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  343. :cond_0
  344. iget-object p2, p0, Lokhttp3/internal/platform/AndroidPlatform;->setAlpnProtocols:Lokhttp3/internal/platform/OptionalMethod;
  345. if-eqz p2, :cond_1
  346. invoke-virtual {p2, p1}, Lokhttp3/internal/platform/OptionalMethod;->isSupported(Ljava/lang/Object;)Z
  347. move-result p2
  348. if-eqz p2, :cond_1
  349. new-array p2, v1, [Ljava/lang/Object;
  350. invoke-static {p3}, Lokhttp3/internal/platform/Platform;->concatLengthPrefixed(Ljava/util/List;)[B
  351. move-result-object p3
  352. aput-object p3, p2, v0
  353. iget-object p3, p0, Lokhttp3/internal/platform/AndroidPlatform;->setAlpnProtocols:Lokhttp3/internal/platform/OptionalMethod;
  354. invoke-virtual {p3, p1, p2}, Lokhttp3/internal/platform/OptionalMethod;->invokeWithoutCheckedException(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  355. :cond_1
  356. return-void
  357. .end method
  358. .method public connectSocket(Ljava/net/Socket;Ljava/net/InetSocketAddress;I)V
  359. .locals 0
  360. .annotation system Ldalvik/annotation/Throws;
  361. value = {
  362. Ljava/io/IOException;
  363. }
  364. .end annotation
  365. :try_start_0
  366. invoke-virtual {p1, p2, p3}, Ljava/net/Socket;->connect(Ljava/net/SocketAddress;I)V
  367. :try_end_0
  368. .catch Ljava/lang/AssertionError; {:try_start_0 .. :try_end_0} :catch_1
  369. .catch Ljava/lang/SecurityException; {:try_start_0 .. :try_end_0} :catch_0
  370. return-void
  371. :catch_0
  372. move-exception p1
  373. new-instance p2, Ljava/io/IOException;
  374. const-string p3, "Exception in connect"
  375. invoke-direct {p2, p3}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  376. invoke-virtual {p2, p1}, Ljava/io/IOException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;
  377. throw p2
  378. :catch_1
  379. move-exception p1
  380. invoke-static {p1}, Lokhttp3/internal/Util;->isAndroidGetsocknameError(Ljava/lang/AssertionError;)Z
  381. move-result p2
  382. if-eqz p2, :cond_0
  383. new-instance p2, Ljava/io/IOException;
  384. invoke-direct {p2, p1}, Ljava/io/IOException;-><init>(Ljava/lang/Throwable;)V
  385. throw p2
  386. :cond_0
  387. throw p1
  388. .end method
  389. .method public getSelectedProtocol(Ljavax/net/ssl/SSLSocket;)Ljava/lang/String;
  390. .locals 3
  391. iget-object v0, p0, Lokhttp3/internal/platform/AndroidPlatform;->getAlpnSelectedProtocol:Lokhttp3/internal/platform/OptionalMethod;
  392. const/4 v1, 0x0
  393. if-nez v0, :cond_0
  394. return-object v1
  395. :cond_0
  396. invoke-virtual {v0, p1}, Lokhttp3/internal/platform/OptionalMethod;->isSupported(Ljava/lang/Object;)Z
  397. move-result v0
  398. if-nez v0, :cond_1
  399. return-object v1
  400. :cond_1
  401. iget-object v0, p0, Lokhttp3/internal/platform/AndroidPlatform;->getAlpnSelectedProtocol:Lokhttp3/internal/platform/OptionalMethod;
  402. const/4 v2, 0x0
  403. new-array v2, v2, [Ljava/lang/Object;
  404. invoke-virtual {v0, p1, v2}, Lokhttp3/internal/platform/OptionalMethod;->invokeWithoutCheckedException(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  405. move-result-object p1
  406. check-cast p1, [B
  407. if-eqz p1, :cond_2
  408. new-instance v1, Ljava/lang/String;
  409. sget-object v0, Lokhttp3/internal/Util;->UTF_8:Ljava/nio/charset/Charset;
  410. invoke-direct {v1, p1, v0}, Ljava/lang/String;-><init>([BLjava/nio/charset/Charset;)V
  411. :cond_2
  412. return-object v1
  413. .end method
  414. .method public getStackTraceForCloseable(Ljava/lang/String;)Ljava/lang/Object;
  415. .locals 1
  416. iget-object v0, p0, Lokhttp3/internal/platform/AndroidPlatform;->closeGuard:Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;
  417. invoke-virtual {v0, p1}, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;->createAndOpen(Ljava/lang/String;)Ljava/lang/Object;
  418. move-result-object p1
  419. return-object p1
  420. .end method
  421. .method public isCleartextTrafficPermitted(Ljava/lang/String;)Z
  422. .locals 4
  423. const-string v0, "android.security.NetworkSecurityPolicy"
  424. :try_start_0
  425. invoke-static {v0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
  426. move-result-object v0
  427. const-string v1, "getInstance"
  428. const/4 v2, 0x0
  429. new-array v3, v2, [Ljava/lang/Class;
  430. invoke-virtual {v0, v1, v3}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  431. move-result-object v1
  432. const/4 v3, 0x0
  433. new-array v2, v2, [Ljava/lang/Object;
  434. invoke-virtual {v1, v3, v2}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  435. move-result-object v1
  436. invoke-direct {p0, p1, v0, v1}, Lokhttp3/internal/platform/AndroidPlatform;->api24IsCleartextTrafficPermitted(Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Object;)Z
  437. move-result p1
  438. :try_end_0
  439. .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_3
  440. .catch Ljava/lang/NoSuchMethodException; {:try_start_0 .. :try_end_0} :catch_3
  441. .catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_2
  442. .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_1
  443. .catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_0
  444. return p1
  445. :catch_0
  446. move-exception p1
  447. goto :goto_0
  448. :catch_1
  449. move-exception p1
  450. goto :goto_0
  451. :catch_2
  452. move-exception p1
  453. :goto_0
  454. const-string v0, "unable to determine cleartext support"
  455. invoke-static {v0, p1}, Lokhttp3/internal/Util;->assertionError(Ljava/lang/String;Ljava/lang/Exception;)Ljava/lang/AssertionError;
  456. move-result-object p1
  457. throw p1
  458. :catch_3
  459. invoke-super {p0, p1}, Lokhttp3/internal/platform/Platform;->isCleartextTrafficPermitted(Ljava/lang/String;)Z
  460. move-result p1
  461. return p1
  462. .end method
  463. .method public log(ILjava/lang/String;Ljava/lang/Throwable;)V
  464. .locals 5
  465. const/4 v0, 0x5
  466. if-ne p1, v0, :cond_0
  467. goto :goto_0
  468. :cond_0
  469. const/4 v0, 0x3
  470. :goto_0
  471. const/16 p1, 0xa
  472. if-eqz p3, :cond_1
  473. new-instance v1, Ljava/lang/StringBuilder;
  474. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  475. invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  476. invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
  477. invoke-static {p3}, Landroid/util/Log;->getStackTraceString(Ljava/lang/Throwable;)Ljava/lang/String;
  478. move-result-object p2
  479. invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  480. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  481. move-result-object p2
  482. :cond_1
  483. const/4 p3, 0x0
  484. invoke-virtual {p2}, Ljava/lang/String;->length()I
  485. move-result v1
  486. :goto_1
  487. if-ge p3, v1, :cond_4
  488. invoke-virtual {p2, p1, p3}, Ljava/lang/String;->indexOf(II)I
  489. move-result v2
  490. const/4 v3, -0x1
  491. if-eq v2, v3, :cond_2
  492. goto :goto_2
  493. :cond_2
  494. move v2, v1
  495. :goto_2
  496. add-int/lit16 v3, p3, 0xfa0
  497. invoke-static {v2, v3}, Ljava/lang/Math;->min(II)I
  498. move-result v3
  499. invoke-virtual {p2, p3, v3}, Ljava/lang/String;->substring(II)Ljava/lang/String;
  500. move-result-object p3
  501. const-string v4, "OkHttp"
  502. invoke-static {v0, v4, p3}, Landroid/util/Log;->println(ILjava/lang/String;Ljava/lang/String;)I
  503. if-lt v3, v2, :cond_3
  504. add-int/lit8 p3, v3, 0x1
  505. goto :goto_1
  506. :cond_3
  507. move p3, v3
  508. goto :goto_2
  509. :cond_4
  510. return-void
  511. .end method
  512. .method public logCloseableLeak(Ljava/lang/String;Ljava/lang/Object;)V
  513. .locals 1
  514. iget-object v0, p0, Lokhttp3/internal/platform/AndroidPlatform;->closeGuard:Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;
  515. invoke-virtual {v0, p2}, Lokhttp3/internal/platform/AndroidPlatform$CloseGuard;->warnIfOpen(Ljava/lang/Object;)Z
  516. move-result p2
  517. if-nez p2, :cond_0
  518. const/4 p2, 0x5
  519. const/4 v0, 0x0
  520. invoke-virtual {p0, p2, p1, v0}, Lokhttp3/internal/platform/AndroidPlatform;->log(ILjava/lang/String;Ljava/lang/Throwable;)V
  521. :cond_0
  522. return-void
  523. .end method
  524. .method public trustManager(Ljavax/net/ssl/SSLSocketFactory;)Ljavax/net/ssl/X509TrustManager;
  525. .locals 4
  526. iget-object v0, p0, Lokhttp3/internal/platform/AndroidPlatform;->sslParametersClass:Ljava/lang/Class;
  527. const-string v1, "sslParameters"
  528. invoke-static {p1, v0, v1}, Lokhttp3/internal/platform/Platform;->readFieldOrNull(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
  529. move-result-object v0
  530. if-nez v0, :cond_0
  531. :try_start_0
  532. const-string v0, "com.google.android.gms.org.conscrypt.SSLParametersImpl"
  533. const/4 v2, 0x0
  534. invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
  535. move-result-object v3
  536. invoke-virtual {v3}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;
  537. move-result-object v3
  538. invoke-static {v0, v2, v3}, Ljava/lang/Class;->forName(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;
  539. move-result-object v0
  540. invoke-static {p1, v0, v1}, Lokhttp3/internal/platform/Platform;->readFieldOrNull(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
  541. move-result-object v0
  542. :try_end_0
  543. .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
  544. goto :goto_0
  545. :catch_0
  546. invoke-super {p0, p1}, Lokhttp3/internal/platform/Platform;->trustManager(Ljavax/net/ssl/SSLSocketFactory;)Ljavax/net/ssl/X509TrustManager;
  547. move-result-object p1
  548. return-object p1
  549. :cond_0
  550. :goto_0
  551. const-class p1, Ljavax/net/ssl/X509TrustManager;
  552. const-string v1, "x509TrustManager"
  553. invoke-static {v0, p1, v1}, Lokhttp3/internal/platform/Platform;->readFieldOrNull(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
  554. move-result-object p1
  555. check-cast p1, Ljavax/net/ssl/X509TrustManager;
  556. if-eqz p1, :cond_1
  557. return-object p1
  558. :cond_1
  559. const-class p1, Ljavax/net/ssl/X509TrustManager;
  560. const-string v1, "trustManager"
  561. invoke-static {v0, p1, v1}, Lokhttp3/internal/platform/Platform;->readFieldOrNull(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
  562. move-result-object p1
  563. check-cast p1, Ljavax/net/ssl/X509TrustManager;
  564. return-object p1
  565. .end method