caarmen / network-monitor

A network monitor tool for Android that executes an http GET to google.com every x seconds and logs the results into a file.
74 stars 27 forks source link

this is also very likely to be a real bug. #109

Closed jay2013 closed 6 years ago

jay2013 commented 6 years ago

Although there are annotations "@targetAPI" in your code, we still believe the report below is also likely to be a real bug. because <android.app.AppOpsManager: int checkOpNoThrow(java.lang.String,int,java.lang.String)> not exist under level 19.

please help to check. Thanks again.

report info: <android.app.AppOpsManager: int checkOpNoThrow(java.lang.String,int,java.lang.String)> called in <ca.rmen.android.networkmonitor.util.PermissionUtil: boolean hasUsageStatsPermission(android.content.Context)> on line 55 not in [16, 17, 18, 14, 15] reachable paths: --><ca.rmen.android.networkmonitor.app.prefs.SelectFieldsActivity: void onRequestPermissionsResult(int,java.lang.String[],int[])> --><ca.rmen.android.networkmonitor.app.prefs.SelectFieldsActivityPermissionsDispatcher: void onRequestPermissionsResult(ca.rmen.android.networkmonitor.app.prefs.SelectFieldsActivity,int,int[])> --><ca.rmen.android.networkmonitor.app.prefs.SelectFieldsActivity: void requestUsagePermission()> --><ca.rmen.android.networkmonitor.util.PermissionUtil: boolean hasUsageStatsPermission(android.content.Context)> --> <android.app.AppOpsManager: int checkOpNoThrow(java.lang.String,int,java.lang.String)>

caarmen commented 6 years ago

SelectFieldsActivity will potentially request the READ_PHONE_STATE permission, if the user checks one of the two "Most consuming app" items.

When the user checks one of these items, the AdapterDataObserver.onChanged() callback is called. If the version is M+, it will call requestPhoneStatePermission(). This is the only way requestPhoneStatePermission() can be called.

This is the only way the other methods targeted with @TargetApi(Build.VERSION_CODES.M) can be reached. In this class, this is the only way we interact with the permissions dispatcher library.

For more info on how the permissions dispatcher library works internally, feel free to take a look at that repo: https://github.com/permissions-dispatcher/PermissionsDispatcher

If you are able to reproduce a crash, please feel free to reopen this (or create a new issue), providing the steps to reproduce to crash, as well as the stack trace.