[Player Model] Corrected DeadSystemException handling #2063
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Corrects
DeadSystemException
handling that was originally added in PR #1937, as it wasn't catching.Details
After reading through the AOSP source code I discovered that it throws RuntimeException and set its cause to RuntimeException via RemoteException.rethrowFromSystemServer(). The original code was trying to catch AndroidException which would have never happened.
Motivation
DeadSystemException
happens after a the app is in a bad state, not the root cause. Suppressing these as they are a red herring.Scope
Code that calls getApplicationInfo, getPackageInfo, and isHuaweiMobileServicesAvailable (seems to use getPackageInfo under its hood).
Related
PR #1937 originally added catching for
DeadSystemException
, however the way it was catching didn't work so this PR corrects that.ASOP
Where
DeadSystemException
is thrown from in AOSP:https://cs.android.com/android/_/android/platform/frameworks/base/+/64ee6e2bc6a57d5649fddddaba456fdb7521e15e:core/java/android/app/ApplicationPackageManager.java;l=201;drc=09014f10482fa6300e80a4bbb51d7f404129bc06;bpv=1;bpt=0
A commit in on 2020-02-20 to AOSP that adds some internal caching:
https://cs.android.com/android/_/android/platform/frameworks/base/+/a46b7b3f5e9398a245d0730d365d1f847d313938
That caching means that newer Android version (Android 12 plus maybe?) had a lower chance of running into this exception. However it still uses
rethrowFromSystemServer()
so the exception will be caught by this PR.Testing
Unit testing
player-model-main unit tests are not running currently.
Manual testing
Tested on Android 14, ensuring the device subscribes for push.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is