android / android/privacy-codelab

Crashed on Android 7

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
21
Forks
13
PR merge metrics
No merged PRs in 30d

Description

it's crashed on Android 7.

```
FATAL EXCEPTION: main
Process: com.example.photogood, PID: 26746
java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=26746, uid=10172 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:1701)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
at android.content.ContentResolver.query(ContentResolver.java:536)
at android.content.ContentResolver.query(ContentResolver.java:478)
at com.example.photolog_end.MediaRepository$fetchImages$1.invokeSuspend(MediaRepository.kt:55)
at com.example.photolog_end.MediaRepository$fetchImages$1.invoke(MediaRepository.kt)
at com.example.photolog_end.MediaRepository$fetchImages$1.invoke(MediaRepository.kt)
at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
at com.example.photolog_end.AddLogViewModel$loadLocalPickerPictures$1$invokeSuspend$$inlined$map$1.collect(SafeCollector.common.kt:113)
at kotlinx.coroutines.flow.FlowKt__CollectionKt.toCollection(Collection.kt:26)
at kotlinx.coroutines.flow.FlowKt.toCollection(Unknown Source)
at kotlinx.coroutines.flow.FlowKt__CollectionKt.toList(Collection.kt:15)
at kotlinx.coroutines.flow.FlowKt.toList(Unknown Source)
at kotlinx.coroutines.flow.FlowKt__CollectionKt.toList$default(Collection.kt:15)
at kotlinx.coroutines.flow.FlowKt.toList$default(Unknown Source)
at com.example.photolog_end.AddLogViewModel$loadLocalPickerPictures$1.invokeSuspend(AddLogViewModel.kt:157)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:367)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
at com.example.photolog_end.AddLogViewModel.loadLocalPickerPictures(AddLogViewModel.kt:156)
at com.example.photolog_end.AddLogScreenKt$AddLogScreen$8$4$1$3$1$1$1.invoke(AddLogScreen.kt:289)
at com.example.photolog_end.AddLogScreenKt$AddLogScreen$8$4$1$3$1$1$1.invoke(AddLogScreen.kt:288)
at com.example.photolog_end.AddLogScreenKt.AddLogScreen$canAddPhoto(AddLogScreen.kt:108)
at com.example.photolog_end.AddLogScreenKt.access$AddLogScreen$canAddPhoto(AddLogScreen.kt:1)
at com.example.photolog_end.AddLogScreenKt$AddLogScreen$8$4$1$3$1$1.invoke(AddLogScreen.kt:288)
at com.example.photolog_end.AddLogScreenKt$AddLogScreen$8$4$1$3$1$1.invoke(AddLogScreen.kt:287)
at androidx.compose.foundation.ClickableKt$clickable$4$gesture$1$2.invoke-k-4lQ0M(Clickable.kt:153)
at androidx.compose.foundation.ClickableKt$clickable$4$gesture$1$2.invoke(Clickable.kt:142)
at androidx.compose.foundation.gestures.TapGestureDetectorKt$detectTapAndPress$2$1$1.invokeSuspend(TapGestureDetector.kt:222)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:178)
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397)
```

Contributor guide

Open the contributing guide

Research direction

Start with MediaRepository.kt:55, where the Android 7 stack trace shows the media query failing, and trace how AddLogViewModel.kt:156-157 loads local picker pictures. Reproduce the crash on Android 7 while loading local images and verify that the permission denial no longer terminates the flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.