权限拒绝:阅读com.android.providers.contacts.CallLogProvider

时间:2013-02-05 14:05:50

标签: android exception permissions

我在特定的手机和运营商上获得此例外:Verizon上的三星Galaxy S3。我在带有Sprint的Evo和带有AT& T的Galaxy Nexus上进行过测试,没有人给我这个错误。我想知道电话运营商是否对操作系统进行了任何修改,现在需要额外的特殊权限。我从拥有Galaxy S3的客户远程记录了以下堆栈跟踪:

堆栈追踪:

    Permission Denial: reading com.android.providers.contacts.CallLogProvider 
uri content://call_log/calls from pid=23104, uid=10233 
requires android.permission.READ_CALL_LOG, or grantUriPermission()
java.lang.SecurityException: Permission Denial: reading 
com.android.providers.contacts.CallLogProvider 
uri content://call_log/calls from pid=23104, uid=10233 
requires android.permission.READ_CALL_LOG, or grantUriPermission()  
at android.os.Parcel.readException(Parcel.java:1430)  at 
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188)  at 
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)  at 
android.content.ContentProviderProxy.query(ContentProviderNative.java:423)  at 
android.content.ContentResolver.query(ContentResolver.java:375)  at 
android.content.ContentResolver.query(ContentResolver.java:318)

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="xyz"
    android:installLocation="auto"
    android:versionCode="1"
    android:versionName="1" >

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.READ_CALENDAR" />
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.WRITE_SMS" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.RECEIVE_MMS" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
    <uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" />
    <uses-permission android:name="android.permission.RESTART_PACKAGES" />
    <uses-permission android:name="android.permission.READ_CALL_LOG" />    
    <uses-permission android:name="android.permission.WRITE_CALL_LOG" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="9">
    </uses-sdk>

1 个答案:

答案 0 :(得分:2)

  

允许应用程序读取用户的通话记录。

     
    

注意:如果您的应用使用READ_CONTACTS权限,并且您的minSdkVersion和targetSdkVersion值都设置为15或更低,系统会隐式授予您的应用此权限。如果您不需要此权限,请确保您的targetSdkVersion为16或更高。

  
     

常量值:&#34; android.permission.READ_CALL_LOG&#34;

根据您的清单:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="9"></uses-sdk>

也许您应该尝试删除READ_CONTACTS权限,或设置targetSdkVersion="9"

来源:Manifest.permissions #READ_CALL_LOG