CacheStrategy.smali 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. .class public final Lokhttp3/internal/cache/CacheStrategy;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/MemberClasses;
  6. value = {
  7. Lokhttp3/internal/cache/CacheStrategy$Factory;
  8. }
  9. .end annotation
  10. # instance fields
  11. .field public final cacheResponse:Lokhttp3/Response;
  12. .field public final networkRequest:Lokhttp3/Request;
  13. # direct methods
  14. .method constructor <init>(Lokhttp3/Request;Lokhttp3/Response;)V
  15. .locals 0
  16. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  17. iput-object p1, p0, Lokhttp3/internal/cache/CacheStrategy;->networkRequest:Lokhttp3/Request;
  18. iput-object p2, p0, Lokhttp3/internal/cache/CacheStrategy;->cacheResponse:Lokhttp3/Response;
  19. return-void
  20. .end method
  21. .method public static isCacheable(Lokhttp3/Response;Lokhttp3/Request;)Z
  22. .locals 3
  23. invoke-virtual {p0}, Lokhttp3/Response;->code()I
  24. move-result v0
  25. const/16 v1, 0xc8
  26. const/4 v2, 0x0
  27. if-eq v0, v1, :cond_2
  28. const/16 v1, 0x19a
  29. if-eq v0, v1, :cond_2
  30. const/16 v1, 0x19e
  31. if-eq v0, v1, :cond_2
  32. const/16 v1, 0x1f5
  33. if-eq v0, v1, :cond_2
  34. const/16 v1, 0xcb
  35. if-eq v0, v1, :cond_2
  36. const/16 v1, 0xcc
  37. if-eq v0, v1, :cond_2
  38. const/16 v1, 0x133
  39. if-eq v0, v1, :cond_0
  40. const/16 v1, 0x134
  41. if-eq v0, v1, :cond_2
  42. const/16 v1, 0x194
  43. if-eq v0, v1, :cond_2
  44. const/16 v1, 0x195
  45. if-eq v0, v1, :cond_2
  46. packed-switch v0, :pswitch_data_0
  47. goto :goto_0
  48. :cond_0
  49. :pswitch_0
  50. const-string v0, "Expires"
  51. invoke-virtual {p0, v0}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
  52. move-result-object v0
  53. if-nez v0, :cond_2
  54. invoke-virtual {p0}, Lokhttp3/Response;->cacheControl()Lokhttp3/CacheControl;
  55. move-result-object v0
  56. invoke-virtual {v0}, Lokhttp3/CacheControl;->maxAgeSeconds()I
  57. move-result v0
  58. const/4 v1, -0x1
  59. if-ne v0, v1, :cond_2
  60. invoke-virtual {p0}, Lokhttp3/Response;->cacheControl()Lokhttp3/CacheControl;
  61. move-result-object v0
  62. invoke-virtual {v0}, Lokhttp3/CacheControl;->isPublic()Z
  63. move-result v0
  64. if-nez v0, :cond_2
  65. invoke-virtual {p0}, Lokhttp3/Response;->cacheControl()Lokhttp3/CacheControl;
  66. move-result-object v0
  67. invoke-virtual {v0}, Lokhttp3/CacheControl;->isPrivate()Z
  68. move-result v0
  69. if-eqz v0, :cond_1
  70. goto :goto_1
  71. :cond_1
  72. :goto_0
  73. return v2
  74. :cond_2
  75. :goto_1
  76. :pswitch_1
  77. invoke-virtual {p0}, Lokhttp3/Response;->cacheControl()Lokhttp3/CacheControl;
  78. move-result-object p0
  79. invoke-virtual {p0}, Lokhttp3/CacheControl;->noStore()Z
  80. move-result p0
  81. if-nez p0, :cond_3
  82. invoke-virtual {p1}, Lokhttp3/Request;->cacheControl()Lokhttp3/CacheControl;
  83. move-result-object p0
  84. invoke-virtual {p0}, Lokhttp3/CacheControl;->noStore()Z
  85. move-result p0
  86. if-nez p0, :cond_3
  87. const/4 v2, 0x1
  88. :cond_3
  89. return v2
  90. :pswitch_data_0
  91. .packed-switch 0x12c
  92. :pswitch_1
  93. :pswitch_1
  94. :pswitch_0
  95. .end packed-switch
  96. .end method