Android Permission拒绝怪异

时间:2011-04-18 16:55:37

标签: android permissions

我正在做一个推特应用程序(是的,另一个......)并在选择相机拍照时相机打开时上传一张照片,但抛出一个异常,所以我无法处理得到的照片。

索尼爱立信Xperia SO-01B固件2.1更新1发生此错误。

代码:

SimpleDateFormat timeStampFormat = new SimpleDateFormat("yyyyMMddHHmmssSS"); 
String filenameTimestamp = timeStampFormat.format(new Date()); 
ContentValues values = new ContentValues(); 
values.put(Media.TITLE, String.format("worldTwitter_%s.jpg", filenameTimestamp));
//values.put(Media.TITLE, String.format("uno.jpg", filenameTimestamp));
values.put(Media.DESCRIPTION, getString(R.string.image_posted_from_o_tweet));
photoUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(intent, REQUEST_CHOOSE_PHOTO_CAMERA);

错误:

04-19 01:28:34.597: ERROR/DatabaseUtils(1595): Writing exception to parcel
04-19 01:28:34.597: ERROR/DatabaseUtils(1595): java.lang.SecurityException: Permission Denial: reading com.sonyericsson.conversations.provider.ConversationsSettingsProvider uri content://com.sonyericsson.conversations/settings from pid=2499, uid=10024 requires com.sonyericsson.permission.CONVERSATIONS_SETTINGS_PROVIDER
04-19 01:28:34.597: ERROR/DatabaseUtils(1595):     at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:240)
04-19 01:28:34.597: ERROR/DatabaseUtils(1595):     at android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:116)
04-19 01:28:34.597: ERROR/DatabaseUtils(1595):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:98)
04-19 01:28:34.597: ERROR/DatabaseUtils(1595):     at android.os.Binder.execTransact(Binder.java:291)
04-19 01:28:34.597: ERROR/DatabaseUtils(1595):     at dalvik.system.NativeStart.run(Native Method)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499): CameraConfigManager:CUSTOMIZATION: An exception occurs in reading provider of conversation application.
04-19 01:28:34.607: ERROR/SemcCameraApp(2499): java.lang.SecurityException: Permission Denial: reading com.sonyericsson.conversations.provider.ConversationsSettingsProvider uri content://com.sonyericsson.conversations/settings from pid=2499, uid=10024 requires com.sonyericsson.permission.CONVERSATIONS_SETTINGS_PROVIDER
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.os.Parcel.readException(Parcel.java:1218)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:160)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.content.ContentProviderProxy.bulkQuery(ContentProviderNative.java:326)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.content.ContentProviderProxy.query(ContentProviderNative.java:345)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.content.ContentResolver.query(ContentResolver.java:202)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at com.sonyericsson.android.camera.CameraConfigManager.readCustomizationSettings(CameraConfigManager.java:2729)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at com.sonyericsson.android.camera.CameraConfigManager.<init>(CameraConfigManager.java:472)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at com.sonyericsson.android.camera.CameraActivity.onCreate(CameraActivity.java:246)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.app.ActivityThread.access$2200(ActivityThread.java:123)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.os.Looper.loop(Looper.java:123)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at android.app.ActivityThread.main(ActivityThread.java:4370)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at java.lang.reflect.Method.invokeNative(Native Method)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at java.lang.reflect.Method.invoke(Method.java:521)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-19 01:28:34.607: ERROR/SemcCameraApp(2499):     at dalvik.system.NativeStart.main(Native Method)

- 代码在模拟器中运行得很好。这是我的androidmanifest: 任何人,任何想法......

         

<uses-permission android:name ="android.permission.INTERNET" />
<uses-permission android:name="com.android.email.permission.ACCESS_PROVIDER" />
<uses-permission android:name="com.android.email.permission.ACCESS_PROVIDER" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<application android:icon="@drawable/icon" android:label="@string/app_name"  

2 个答案:

答案 0 :(得分:0)

你读过自己的错误吗?

requires com.sonyericsson.permission.CONVERSATIONS_SETTINGS_PROVIDER

因为这个错误有'com.sonyericsson'。我假设这将是一个自定义权限。不知道还能告诉你什么。

答案 1 :(得分:0)

您现在使用的是实际设备,因此如果制造商有这样的权限,权限会有所不同。 (这意味着他们对标准任务使用非标准意图。)

添加:

<uses-permission android:name="com.sonyericsson.permission.CONVERSATIONS_SETTINGS_PROVIDER" />

到你的清单。然后看看它是否适用于索尼。