mapbox-navigation-android icon indicating copy to clipboard operation
mapbox-navigation-android copied to clipboard

use media store on newer versions to write files

Open dzinad opened this issue 3 years ago • 6 comments

Description

The permissions are unused, tests pass without them. In Android 13 more granular media permissions are introduced so it would be nice to clean up our media permissions usage.

dzinad avatar Aug 09 '22 09:08 dzinad

Codecov Report

Merging #6135 (d33c277) into main (c4fed76) will decrease coverage by 0.02%. The diff coverage is 62.39%.

:exclamation: Current head d33c277 differs from pull request most recent head bf06690. Consider uploading reports for the commit bf06690 to get more accurate results

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #6135      +/-   ##
============================================
- Coverage     68.87%   68.84%   -0.03%     
+ Complexity     4339     4336       -3     
============================================
  Files           650      650              
  Lines         26084    26102      +18     
  Branches       3056     3061       +5     
============================================
+ Hits          17965    17971       +6     
- Misses         6957     6968      +11     
- Partials       1162     1163       +1     
Impacted Files Coverage Δ
...om/mapbox/navigation/base/route/NavigationRoute.kt 51.20% <ø> (+0.48%) :arrow_up:
...ion/base/trip/model/roadobject/RoadObjectMapper.kt 0.00% <0.00%> (ø)
...on/base/trip/model/roadobject/reststop/RestStop.kt 0.00% <0.00%> (ø)
...aps/route/line/model/RouteLineGranularDistances.kt 27.27% <20.00%> (-72.73%) :arrow_down:
...e/routealternatives/RouteAlternativesController.kt 76.42% <50.00%> (-0.55%) :arrow_down:
...ation/ui/maps/route/line/api/MapboxRouteLineApi.kt 83.89% <56.41%> (+0.39%) :arrow_up:
...mapbox/navigation/ui/maps/util/CacheResultUtils.kt 93.61% <76.92%> (-6.39%) :arrow_down:
...i/maps/internal/route/line/MapboxRouteLineUtils.kt 87.69% <80.48%> (+0.16%) :arrow_up:
...ation/ui/maps/route/line/api/VanishingRouteLine.kt 87.12% <100.00%> (-0.57%) :arrow_down:
...navigation/ui/maps/route/line/model/RoutePoints.kt 100.00% <100.00%> (ø)
... and 3 more

codecov[bot] avatar Aug 09 '22 09:08 codecov[bot]

I'm wondering how does com.mapbox.navigation.instrumentation_tests.utils.history.MapboxHistoryTestRule#finished work without WRITE_EXTERNAL_STORAGE permission? 🤔 Maybe it fails silently? Can you please double check that history files appear in download folder after tests run?

VysotskiVadim avatar Aug 09 '22 10:08 VysotskiVadim

I'm wondering how does com.mapbox.navigation.instrumentation_tests.utils.history.MapboxHistoryTestRule#finished work without WRITE_EXTERNAL_STORAGE permission? 🤔 Maybe it fails silently? Can you please double check that history files appear in download folder after tests run?

I checked tests results on device farm and history files are really there 😮 But I'm struggling to understand why it works 😅

VysotskiVadim avatar Aug 09 '22 10:08 VysotskiVadim

I checked tests results on device farm and history files are really there 😮 But I'm struggling to understand why it works 😅

could you try it on local devices? suppose, device farm devices might have some permissions by default.

RingerJK avatar Aug 11 '22 08:08 RingerJK

also, some instrumentation tests are failing because cannot find files in the download folder 🤔

RingerJK avatar Aug 11 '22 08:08 RingerJK

I checked tests results on device farm and history files are really there 😮 But I'm struggling to understand why it works 😅

Maybe devices were specific. I tried on an absolutely new sample: the approach we used (Environment.getExternalStoragePublicDirectory) does require the permission (although I ran into some cases when it worked without it, I'm guessing some caches or sth). I updated the PR. I left the permissions and used MediaStore API for newer versions of Android.

dzinad avatar Aug 11 '22 16:08 dzinad