/docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/com/google/android/exoplayer2/p110h/C41613s.java

https://github.com/HelloHuDi/AndroidReverseNotes · Java · 292 lines · 249 code · 27 blank · 16 comment · 41 complexity · 1f63cd3459c7b72dd639e4a9a6d6e3f2 MD5 · raw file

  1. package com.google.android.exoplayer2.p110h;
  2. import android.annotation.SuppressLint;
  3. import android.os.Handler;
  4. import android.os.Looper;
  5. import android.os.Message;
  6. import android.os.SystemClock;
  7. import com.google.android.exoplayer2.p111i.C17675v;
  8. import com.google.android.exoplayer2.p111i.C41619t;
  9. import com.google.android.exoplayer2.p111i.C45039a;
  10. import com.tencent.matrix.trace.core.AppMethodBeat;
  11. import java.io.IOException;
  12. import java.util.concurrent.ExecutorService;
  13. /* renamed from: com.google.android.exoplayer2.h.s */
  14. public final class C41613s {
  15. IOException biw;
  16. final ExecutorService bqJ;
  17. C32058b<? extends C32059c> bqK;
  18. /* renamed from: com.google.android.exoplayer2.h.s$a */
  19. public interface C8683a<T extends C32059c> {
  20. /* renamed from: a */
  21. int mo2603a(T t, long j, long j2, IOException iOException);
  22. /* renamed from: a */
  23. void mo2604a(T t, long j, long j2);
  24. /* renamed from: a */
  25. void mo2605a(T t, long j, long j2, boolean z);
  26. }
  27. @SuppressLint({"HandlerLeak"})
  28. /* renamed from: com.google.android.exoplayer2.h.s$b */
  29. final class C32058b<T extends C32059c> extends Handler implements Runnable {
  30. private final T bqL;
  31. private final C8683a<T> bqM;
  32. public final int bqN;
  33. private final long bqO;
  34. private IOException bqP;
  35. private int bqQ;
  36. private volatile Thread bqR;
  37. private volatile boolean released;
  38. public C32058b(Looper looper, T t, C8683a<T> c8683a, int i, long j) {
  39. super(looper);
  40. this.bqL = t;
  41. this.bqM = c8683a;
  42. this.bqN = i;
  43. this.bqO = j;
  44. }
  45. public final void start(long j) {
  46. AppMethodBeat.m2504i(95844);
  47. C45039a.checkState(C41613s.this.bqK == null);
  48. C41613s.this.bqK = this;
  49. if (j > 0) {
  50. sendEmptyMessageDelayed(0, j);
  51. AppMethodBeat.m2505o(95844);
  52. return;
  53. }
  54. execute();
  55. AppMethodBeat.m2505o(95844);
  56. }
  57. public final void cancel(boolean z) {
  58. AppMethodBeat.m2504i(95845);
  59. this.released = z;
  60. this.bqP = null;
  61. if (hasMessages(0)) {
  62. removeMessages(0);
  63. if (!z) {
  64. sendEmptyMessage(1);
  65. }
  66. } else {
  67. this.bqL.mo19287se();
  68. if (this.bqR != null) {
  69. this.bqR.interrupt();
  70. }
  71. }
  72. if (z) {
  73. finish();
  74. long elapsedRealtime = SystemClock.elapsedRealtime();
  75. this.bqM.mo2605a(this.bqL, elapsedRealtime, elapsedRealtime - this.bqO, true);
  76. }
  77. AppMethodBeat.m2505o(95845);
  78. }
  79. public final void run() {
  80. AppMethodBeat.m2504i(95846);
  81. try {
  82. this.bqR = Thread.currentThread();
  83. if (!this.bqL.mo19288sf()) {
  84. C41619t.beginSection("load:" + this.bqL.getClass().getSimpleName());
  85. this.bqL.mo19289sg();
  86. C41619t.endSection();
  87. }
  88. if (!this.released) {
  89. sendEmptyMessage(2);
  90. }
  91. AppMethodBeat.m2505o(95846);
  92. } catch (IOException e) {
  93. if (!this.released) {
  94. obtainMessage(3, e).sendToTarget();
  95. }
  96. AppMethodBeat.m2505o(95846);
  97. } catch (InterruptedException e2) {
  98. C45039a.checkState(this.bqL.mo19288sf());
  99. if (!this.released) {
  100. sendEmptyMessage(2);
  101. }
  102. AppMethodBeat.m2505o(95846);
  103. } catch (Exception e3) {
  104. if (!this.released) {
  105. obtainMessage(3, new C32061f(e3)).sendToTarget();
  106. }
  107. AppMethodBeat.m2505o(95846);
  108. } catch (OutOfMemoryError e4) {
  109. if (!this.released) {
  110. obtainMessage(3, new C32061f(e4)).sendToTarget();
  111. }
  112. AppMethodBeat.m2505o(95846);
  113. } catch (Error e5) {
  114. if (!this.released) {
  115. obtainMessage(4, e5).sendToTarget();
  116. }
  117. AppMethodBeat.m2505o(95846);
  118. throw e5;
  119. } catch (Throwable th) {
  120. C41619t.endSection();
  121. AppMethodBeat.m2505o(95846);
  122. }
  123. }
  124. public final void handleMessage(Message message) {
  125. AppMethodBeat.m2504i(95847);
  126. if (this.released) {
  127. AppMethodBeat.m2505o(95847);
  128. } else if (message.what == 0) {
  129. execute();
  130. AppMethodBeat.m2505o(95847);
  131. } else if (message.what == 4) {
  132. Error error = (Error) message.obj;
  133. AppMethodBeat.m2505o(95847);
  134. throw error;
  135. } else {
  136. finish();
  137. long elapsedRealtime = SystemClock.elapsedRealtime();
  138. long j = elapsedRealtime - this.bqO;
  139. if (this.bqL.mo19288sf()) {
  140. this.bqM.mo2605a(this.bqL, elapsedRealtime, j, false);
  141. AppMethodBeat.m2505o(95847);
  142. return;
  143. }
  144. switch (message.what) {
  145. case 1:
  146. this.bqM.mo2605a(this.bqL, elapsedRealtime, j, false);
  147. AppMethodBeat.m2505o(95847);
  148. return;
  149. case 2:
  150. this.bqM.mo2604a(this.bqL, elapsedRealtime, j);
  151. AppMethodBeat.m2505o(95847);
  152. return;
  153. case 3:
  154. this.bqP = (IOException) message.obj;
  155. int a = this.bqM.mo2603a(this.bqL, elapsedRealtime, j, this.bqP);
  156. if (a != 3) {
  157. if (a != 2) {
  158. if (a == 1) {
  159. a = 1;
  160. } else {
  161. a = this.bqQ + 1;
  162. }
  163. this.bqQ = a;
  164. start((long) Math.min((this.bqQ - 1) * 1000, 5000));
  165. break;
  166. }
  167. }
  168. C41613s.this.biw = this.bqP;
  169. AppMethodBeat.m2505o(95847);
  170. return;
  171. break;
  172. }
  173. AppMethodBeat.m2505o(95847);
  174. }
  175. }
  176. private void execute() {
  177. AppMethodBeat.m2504i(95848);
  178. this.bqP = null;
  179. C41613s.this.bqJ.execute(C41613s.this.bqK);
  180. AppMethodBeat.m2505o(95848);
  181. }
  182. private void finish() {
  183. C41613s.this.bqK = null;
  184. }
  185. }
  186. /* renamed from: com.google.android.exoplayer2.h.s$c */
  187. public interface C32059c {
  188. /* renamed from: se */
  189. void mo19287se();
  190. /* renamed from: sf */
  191. boolean mo19288sf();
  192. /* renamed from: sg */
  193. void mo19289sg();
  194. }
  195. /* renamed from: com.google.android.exoplayer2.h.s$d */
  196. public interface C32060d {
  197. /* renamed from: rZ */
  198. void mo52350rZ();
  199. }
  200. /* renamed from: com.google.android.exoplayer2.h.s$f */
  201. public static final class C32061f extends IOException {
  202. public C32061f(Throwable th) {
  203. super("Unexpected " + th.getClass().getSimpleName() + ": " + th.getMessage(), th);
  204. AppMethodBeat.m2504i(95851);
  205. AppMethodBeat.m2505o(95851);
  206. }
  207. }
  208. /* renamed from: com.google.android.exoplayer2.h.s$e */
  209. static final class C37262e extends Handler implements Runnable {
  210. private final C32060d bqT;
  211. public C37262e(C32060d c32060d) {
  212. this.bqT = c32060d;
  213. }
  214. public final void run() {
  215. AppMethodBeat.m2504i(95849);
  216. sendEmptyMessage(0);
  217. AppMethodBeat.m2505o(95849);
  218. }
  219. public final void handleMessage(Message message) {
  220. AppMethodBeat.m2504i(95850);
  221. this.bqT.mo52350rZ();
  222. AppMethodBeat.m2505o(95850);
  223. }
  224. }
  225. public C41613s(String str) {
  226. AppMethodBeat.m2504i(95852);
  227. this.bqJ = C17675v.m27557aO(str);
  228. AppMethodBeat.m2505o(95852);
  229. }
  230. /* renamed from: a */
  231. public final <T extends C32059c> long mo66741a(T t, C8683a<T> c8683a, int i) {
  232. AppMethodBeat.m2504i(95853);
  233. Looper myLooper = Looper.myLooper();
  234. C45039a.checkState(myLooper != null);
  235. long elapsedRealtime = SystemClock.elapsedRealtime();
  236. new C32058b(myLooper, t, c8683a, i, elapsedRealtime).start(0);
  237. AppMethodBeat.m2505o(95853);
  238. return elapsedRealtime;
  239. }
  240. public final boolean isLoading() {
  241. return this.bqK != null;
  242. }
  243. public final void cancelLoading() {
  244. AppMethodBeat.m2504i(95854);
  245. this.bqK.cancel(false);
  246. AppMethodBeat.m2505o(95854);
  247. }
  248. /* renamed from: a */
  249. public final boolean mo66742a(C32060d c32060d) {
  250. AppMethodBeat.m2504i(95855);
  251. boolean z = false;
  252. if (this.bqK != null) {
  253. this.bqK.cancel(true);
  254. if (c32060d != null) {
  255. this.bqJ.execute(new C37262e(c32060d));
  256. }
  257. } else if (c32060d != null) {
  258. c32060d.mo52350rZ();
  259. z = true;
  260. }
  261. this.bqJ.shutdown();
  262. AppMethodBeat.m2505o(95855);
  263. return z;
  264. }
  265. }