Picking a document inside Android Work Profile via Google Drive crashing app
daviluisb opened this issue · 1 comments
Bug report
Summary
Just need to download any application via Work Profile on Android then use any type of Document Picker, if i choose a Google drive file from my Work Profile Account the picker will work just fine, if i choose a Google drive file from another account, like a personal account the app will just crash reporting a native error.
Reproducible sample code
import DocumentPicker, { types } from 'react-native-document-picker';
- Just need to run a simple picker usage like
export async function takeDocument() {
const { name, uri, type } = await DocumentPicker.pickSingle({
type: [
types.csv,
types.doc,
types.docx,
types.pdf,
types.plainText,
types.ppt,
types.pptx,
types.xls,
types.xlsx,
],
});
return { name, uri, mimeType: type || String() };
}
Steps to reproduce
- Download the app inside the PlayStore via Work Profile
- Use the picker then choose a GoogleDrive file from another account instead of the Work Profile Account
Describe what you expected to happen:
- The picker will open just fine
- If i choose any GoogleDrive file accessible by my Work Profile Account the selected file will work
- If i choose a GoogleDrive file from another account, not my Work Profile Account, the app will just crash reporting these logs via logcat.
2023-12-14 12:14:24.440 28368-29009/? E/DatabaseUtils: Writing exception to parcel
java.lang.SecurityException: Package com.app.main does not belong to 1111246
at android.app.AppOpsManager.checkPackage(AppOpsManager.java:8803)
at android.content.ContentProvider.getCallingAttributionSource(ContentProvider.java:1096)
at android.content.ContentProvider.getCallingPackage(ContentProvider.java:1076)
at hpd.d(PG:2)
at hpd.openDocument(PG:43)
at android.provider.DocumentsProvider.openAssetFile(DocumentsProvider.java:1334)
at android.provider.DocumentsProvider.openTypedAssetFileImpl(DocumentsProvider.java:1444)
at android.provider.DocumentsProvider.openTypedAssetFile(DocumentsProvider.java:1376)
at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:562)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:327)
at android.os.Binder.execTransactInternal(Binder.java:1215)
at android.os.Binder.execTransact(Binder.java:1179)
2023-12-14 12:14:24.441 27221-27221/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.main, PID: 27221
java.lang.SecurityException: Package com.app.main does not belong to 1111246
at android.os.Parcel.createExceptionOrNull(Parcel.java:2438)
at android.os.Parcel.createException(Parcel.java:2422)
at android.os.Parcel.readException(Parcel.java:2405)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:153)
at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:780)
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:2034)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1849)
at android.content.ContentResolver.openInputStream(ContentResolver.java:1525)
at org.wonday.pdf.PdfView.drawPdf(PdfView.java:236)
at org.wonday.pdf.RCTPdfManager.onAfterUpdateTransaction(RCTPdfManager.java:131)
at org.wonday.pdf.RCTPdfManager.onAfterUpdateTransaction(RCTPdfManager.java:36)
at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:50)
at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:144)
at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:77)
at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281)
at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:194)
at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:909)
at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026)
at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1086)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1106)
at android.view.Choreographer.doCallbacks(Choreographer.java:866)
at android.view.Choreographer.doFrame(Choreographer.java:792)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Environment info
npx react-native info
output:
System:
OS: macOS 14.3
CPU: (8) arm64 Apple M1
Memory: 81.97 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
Yarn: 1.22.19 - ~/Desktop/usabit-space-app/node_modules/.bin/yarn
npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm
Watchman: 2023.08.28.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, watchOS 10.2
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 15.1/15C65 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.12 => 0.69.12
react-native-macos: Not Found
library version: "react-native-document-picker": "^9.1.0",
iOS / Android version: 17.2 / SDK 31 Android 12
Hello and thanks for reporting,
there is no mention of reactnativedocumentpicker
in the stack trace. I do, however, see org.wonday.pdf.RCTPdfManager
- I therefor believe the issue is there, not in this package.
If you think otherwise, please feel free to open another issue with more details.
Thank you 🙂