简体   繁体   English

权限拒绝:开放提供者Adobe Reader

[英]Permission Denial: opening provider Adobe Reader

I have problem with my app when I use code: 使用代码时我的应用出现问题:

 Cursor cursor = context.getContentResolver().query(uri, null, null, null, null);

java.lang.SecurityException: Permission Denial: opening provider com.adobe.reader.misc.ARFileProvider java.lang.SecurityException:权限拒绝:打开提供程序com.adobe.reader.misc.ARFileProvider

In Manifest I try add 在清单中,我尝试添加

<uses-permission android:name="com.adobe.reader.misc.ARFileProvider.READ_DATABASE"/>
<uses-permission android:name="com.adobe.reader.misc.ARFileProvider.WRITE_DATABASE"/>
<uses-permission android:name="com.adobe.reader.misc.ARFileProvider"/>
<uses-permission android:name="com.adobe.reader.misc"/>
<uses-permission android:name="com.adobe.reader.misc.READ_DATABASE"/>
<uses-permission android:name="com.adobe.reader.misc.WRITE_DATABASE"/>
<uses-permission android:name="com.adobe.reader"/>

But I have all time this error when I want cursor from uri from Adobe Reader or InputStream... 但是当我想从Adobe Reader或InputStream的uri中获取光标时,我总是遇到这个错误。

Help me pls :) Thanks for all 帮帮我:)谢谢大家

Ralph 拉尔夫

Manifest 表现

<?xml version="1.0" encoding="utf-8"?>

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
<uses-permission android:name="android.permission.READ_USER_DICTIONARY"/>

<uses-permission android:name="com.adobe.reader.misc.ARFileProvider.READ_DATABASE"/>
<uses-permission android:name="com.adobe.reader.misc.ARFileProvider.WRITE_DATABASE"/>
<uses-permission android:name="com.adobe.reader.misc.ARFileProvider"/>
<uses-permission android:name="com.adobe.reader.misc"/>
<uses-permission android:name="com.adobe.reader.misc.READ_DATABASE"/>
<uses-permission android:name="com.adobe.reader.misc.WRITE_DATABASE"/>
<uses-permission android:name="com.adobe.reader"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <receiver android:name="pl.coig.intradokmobile.UserInterface.Services.ShareService$CloseButtonListener" />
    <receiver android:name="pl.coig.intradokmobile.UserInterface.MainApplication.DocumentDetailsFragment$ServiceReceiver" />

    <activity
        android:name="pl.coig.intradokmobile.UserInterface.DiagnosticActivity"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:label="@string/app_name" >
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.StartupConfigPages.FirstApplicationRunActivity"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:label="@string/app_name" >
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.MainApplication.MainActivity"
        android:configChanges="keyboardHidden|screenSize|orientation"
        android:label="@string/app_name" >
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.StartupConfigPages.ChooseStartupScreenActivity"
        android:configChanges="keyboardHidden|screenSize|orientation"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.StartupConfigPages.ConnectToActivity"
        android:configChanges="keyboardHidden|screenSize|orientation"
        android:label="@string/app_name" >
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.StartupConfigPages.ConfigSummarySuccessActivity"
        android:label="@string/app_name" >
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.StartupConfigPages.ConfigSummaryFailureActivity"
        android:label="@string/app_name" >
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.StartupConfigPages.CaptureActivity"
        android:configChanges="orientation|keyboardHidden"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateAlwaysHidden" >
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.ShareActivity"
        android:theme="@style/Theme.Transparent" >
        <intent-filter>
            <action android:name="android.intent.action.SEND" />

            <category android:name="android.intent.category.DEFAULT" />

            <data android:mimeType="image/*" />
            <data android:mimeType="video/*" />
            <data android:mimeType="audio/*" />
            <data android:mimeType="text/*" />
            <data android:mimeType="text/x-vcard" />
            <data android:mimeType="text/plain" />
            <data android:mimeType="text/html" />
            <data android:mimeType="text/rtf" />
            <data android:mimeType="application/zip" />
            <data android:mimeType="application/vnd.ms-excel" />
            <data android:mimeType="application/msword" />
            <data android:mimeType="application/vnd.ms-powerpoint" />
            <data android:mimeType="application/pdf" />
            <data android:mimeType="application/doc" />
            <data android:mimeType="application/docx" />
            <data android:mimeType="*/*" />
            <data android:pathPattern=".*\\.txt" />
            <data android:pathPattern=".*\\.pdf" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.SEND_MULTIPLE" />

            <category android:name="android.intent.category.DEFAULT" />

            <data android:mimeType="*/*" />
        </intent-filter>
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.EnterShop"
        android:label="@string/app_name"
        android:theme="@style/Theme.Transparent" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
        </intent-filter>
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.StartupConfigPages.ManualPairDeviceActivity"
        android:label="@string/title_activity_manual_pair_device" >
    </activity>
    <activity
        android:name="pl.coig.intradokmobile.UserInterface.MainApplication.SearchActivity"
        android:label="@string/app_name"
        android:launchMode="singleTop" >
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>

        <meta-data
            android:name="android.app.searchable"
            android:resource="@xml/searchable" />
    </activity>

    <service
        android:name="pl.coig.intradokmobile.UserInterface.Services.ShareService"
        android:enabled="true" >
    </service>
    <service
        android:name="pl.coig.intradokmobile.UserInterface.Services.DownloadService"
        android:enabled="true" >
    </service>

    <activity
        android:name="pl.coig.intradokmobile.UserInterface.FilePicker.BackHandlingFilePickerActivity"
        android:label="@string/app_name"
        android:theme="@style/FilePickerTheme" >
        <intent-filter>
            <action android:name="android.intent.action.GET_CONTENT" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <service
        android:name="pl.coig.intradokmobile.UserInterface.Services.DownloadAllService"
        android:exported="false" >
    </service>

    <activity
        android:name="pl.coig.intradokmobile.UserInterface.MainApplication.FeedbackActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
    </activity>

    <receiver
        android:name="pl.coig.intradokmobile.Models.NetworkChangeReceiver"
        android:label="NetworkChangeReceiver" >
        <intent-filter>
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            <action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
        </intent-filter>
    </receiver>


</application>

Part of code where I use content uri from Adobe Reader 我使用Adobe Reader中的内容uri的部分代码

Cursor cursor = context.getContentResolver().query(uri, null, null, null, null);



InputStream inputStream  = context.getContentResolver().openInputStream(uri);

Uri from Adobe Reader is somethink like that Adobe Reader的Uri就是这样

content://com.adobe.reader.fileprovider/root_external/storage/emulated/0/Download/Adobe%2 0Acrobat/document.pdf 内容://com.adobe.reader.fileprovider/root_external/storage/emulated/0/Download/Adobe%2 0Acrobat / document.pdf

I get this Uri from Intent 我从Intent得到这个Uri

Uri fileUri = intent.getParcelableExtra(Intent.EXTRA_STREAM); 

LOGCAT: logcat的:

 java.lang.SecurityException: Permission Denial: opening provider com.adobe.reader.misc.ARFileProvider from ProcessRecord{1f7f73c1 16260:pl.coig.intradokmobile/u0a133} (pid=16260, uid=10133) that is not exported from uid 10092
        at android.os.Parcel.readException(Parcel.java:1546)
        at android.os.Parcel.readException(Parcel.java:1499)
        at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:3350)
        at android.app.ActivityThread.acquireProvider(ActivityThread.java:4664)
        at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2533)
        at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1442)
        at android.content.ContentResolver.query(ContentResolver.java:462)
        at android.content.ContentResolver.query(ContentResolver.java:422)
        at pl.coig.intradokmobile.Models.FileManager.getRealPathFromURI(FileManager.java:451)
        at pl.coig.intradokmobile.Models.FileManager.getFileFromUri(FileManager.java:358)
        at pl.coig.intradokmobile.UserInterface.Services.ShareService.handleSendFile(ShareService.java:320)
        at pl.coig.intradokmobile.UserInterface.Services.ShareService.onHandleIntent(ShareService.java:103)
        at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.os.HandlerThread.run(HandlerThread.java:61)
private void showPdf(String path) { 

    Uri uri = getUri(path);
    Intent intent =intentForOtherApps(uri);
    Intent openintent = Intent.createChooser(intent, "Open File");

    try{
        startActivity(openintent);
    }catch (ActivityNotFoundException e){

    }
    }
}
private Intent intentForOtherApps(Uri imageUriforPDF) {
    Intent openpdfIntent = new Intent(Intent.ACTION_VIEW);
    openpdfIntent.setDataAndType(imageUriforPDF, "application/pdf");
    openpdfIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    openpdfIntent.addFlags(PendingIntent.FLAG_UPDATE_CURRENT);
    if ( Build.VERSION.SDK_INT <= 23 ) {
        List<ResolveInfo> resInfoList = getApplicationContext().getPackageManager().
                queryIntentActivities(openpdfIntent, PackageManager.MATCH_DEFAULT_ONLY);
        for (ResolveInfo resolveInfo : resInfoList) {
            String packageName = resolveInfo.activityInfo.packageName;
            getApplicationContext().grantUriPermission(packageName, imageUriforPDF, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
        }

    openpdfIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION );
    openpdfIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    return openpdfIntent;
}
private Uri getUri(String path) {
    Uri fileUri= FileProvider.getUriForFile(context,
            "myprovider.fileprovider",
            new File(path));
    return fileUri;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 权限拒绝:打开未从 UID 1000 导出的提供程序 - Permission Denial: opening provider that is not exported from UID 1000 权限拒绝:打开提供程序android.support.v4.content.FileProvider - Permission Denial: opening provider android.support.v4.content.FileProvider java.lang.SecurityException:权限拒绝:实现内容提供者时打开提供者 - java.lang.SecurityException: Permission Denial: opening provider when implement content provider 日历提供程序:Android 8上的权限拒绝 - Calendar Provider: Permission Denial on Android 8 权限拒绝:重新启动应用程序时打开提供程序 com.android.providers.media.MediaDocumentsProvider - Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider when RESTARTING the app 我该如何解决Google Play游戏服务:SecurityException:权限拒绝:打开提供程序? - How I solve Google Play Game Services: SecurityException: Permission Denial: opening provider? 权限拒绝:打开提供程序 com.android.providers.contacts.ContactsProvider2 Read_Contacts 并且我没有写权限 - Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 Read_Contacts and I don't have a write permission 自定义内容提供程序和权限拒绝例外 - Custom content provider and Permission Denial exception itext生成的pdf无法在Adobe Reader中打开? - Itext generated pdf not opening in Adobe reader? 安全异常:权限被拒绝 - Security Exception: Permission Denial
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM