()
| 298 | } |
| 299 | |
| 300 | private void deliver() { |
| 301 | if ("androidx.fragment.app.FragmentViewLifecycleOwner".equals(owner.getClass().getName())) |
| 302 | try { |
| 303 | Field mFragment = owner.getClass().getDeclaredField("mFragment"); |
| 304 | mFragment.setAccessible(true); |
| 305 | Fragment fragment = (Fragment) mFragment.get(owner); |
| 306 | if (fragment != null && |
| 307 | (fragment.getContext() == null || fragment.getActivity() == null)) { |
| 308 | // Since deliver is executed for resumed fragments only, this should never happen |
| 309 | Log.e("Fragment without activity" + |
| 310 | " task=" + name + |
| 311 | " context=" + (fragment.getContext() != null) + |
| 312 | " activity=" + (fragment.getActivity() != null) + |
| 313 | " fragment=" + fragment.getClass().getName() + |
| 314 | " lifecycle=" + owner.getLifecycle().getCurrentState()); |
| 315 | return; |
| 316 | } |
| 317 | } catch (Throwable ex) { |
| 318 | Log.w(ex); |
| 319 | } |
| 320 | try { |
| 321 | onPostExecute(args); |
| 322 | } catch (Throwable ex) { |
| 323 | Log.e(ex); |
| 324 | try { |
| 325 | onException(args, ex); |
| 326 | } catch (Throwable exex) { |
| 327 | Log.e(exex); |
| 328 | } |
| 329 | } finally { |
| 330 | try { |
| 331 | if (error == null) { |
| 332 | if (log && BuildConfig.BETA_RELEASE) { |
| 333 | Log.i("Crumb " + name); |
| 334 | Map<String, String> crumb = new HashMap<>(); |
| 335 | crumb.put("name", name); |
| 336 | Log.breadcrumb("task", crumb); |
| 337 | } |
| 338 | |
| 339 | onExecuted(args, (T) data); |
| 340 | } else |
| 341 | try { |
| 342 | onException(args, error); |
| 343 | } catch (Throwable exex) { |
| 344 | Log.e(exex); |
| 345 | } |
| 346 | } catch (Throwable ex) { |
| 347 | Log.e(ex); |
| 348 | try { |
| 349 | onException(args, ex); |
| 350 | } catch (Throwable exex) { |
| 351 | Log.e(exex); |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | }); |
| 357 | } |
no test coverage detected