-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Labels
Good First IssueGood for first time contributionsGood for first time contributionsType: BugFix something that isn't working as intendedFix something that isn't working as intended
Description
Describe the bug
I came across a telemetry entry that had this message in the device section:
"userAgent": "Mozilla/5.0 (Linux; Android 7.0; TECNO WX3P Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Crosswalk/23.53.589.4 Mobile Safari/537.36 org.livinggoods.smarthealth.region1.ug/v0.4.33",
"deviceInfo": {
"error": true,
"message": "Problem fetching device info: class java.lang.NullPointerException: Attempt to invoke virtual method 'int android.net.NetworkCapabilities.getLinkDownstreamBandwidthKbps()' on a null object reference"
},
Link to forum post sharing the full telemetry entry: https://forum.communityhealthtoolkit.org/t/error-loading-tasks/2471/9
To Reproduce
Unclear on the reproduction steps. I have tried removing sims, enabling airplane mode, enabling extreme battery saver and my test device still returned network capabilities.
Loading the CHT About page should query the cht-android getDeviceInfo
.
Expected behavior
Even if the device has no network capabilities, the app should not throw an error.
Development steps
- Update the
getDeviceInfo
function to correctly treat null values fromgetNetworkCapabilities
- Add Unit test to validate the behavior. There are no unit tests yet for this class. The new unit test file should be added in this folder: https://github.com/medic/cht-android/tree/1813da726a4ba3b1cb83221a216b42df45145675/src/main/java/org/medicmobile/webapp/mobile
Metadata
Metadata
Assignees
Labels
Good First IssueGood for first time contributionsGood for first time contributionsType: BugFix something that isn't working as intendedFix something that isn't working as intended