权限被拒绝,但没有任何失败

时间:2014-07-29 22:26:51

标签: android android-intent permissions

每次我使用startActivityForResult()时,我都会在logcat中获得这一行:

07-30 00:18:07.013: W/ActivityManager(2889): Permission denied: checkComponentPermission() owningUid=10095

但实际上没有任何失败,我没有得到例外,一切都按预期运作。 我不知道该怎么办,或者这是否会导致其他设备出现问题。

以下是我使用的意图的完整代码:

// Determine Uri of camera image to save.
final File sdImageMainDirectory = getTempFile();
outputFileUri = Uri.fromFile(sdImageMainDirectory);

// Camera.
final List<Intent> cameraIntents = new ArrayList<Intent>();
final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
final PackageManager packageManager = getPackageManager();
final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0);
for (ResolveInfo res : listCam) {
    final String packageName = res.activityInfo.packageName;
    final Intent intent = new Intent(captureIntent);
    intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
    intent.setPackage(packageName);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
    cameraIntents.add(intent);
}

// Filesystem.
final Intent galleryIntent = new Intent();
galleryIntent.setType("image/*");
galleryIntent.setAction(Intent.ACTION_GET_CONTENT);

// Chooser of filesystem options.
final Intent chooserIntent = Intent.createChooser(galleryIntent, "Select Source");

// Add the camera options.
chooserIntent
        .putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[] {}));
startActivityForResult(chooserIntent, SELECT_PHOTO);`

为什么会发生这种情况,我该怎么办呢?我怎样才能知道为什么会收到这条消息?

0 个答案:

没有答案
相关问题