Example usage for android.os StrictMode disableDeathOnFileUriExposure

List of usage examples for android.os StrictMode disableDeathOnFileUriExposure

Introduction

In this page you can find the example usage for android.os StrictMode disableDeathOnFileUriExposure.

Prototype

@UnsupportedAppUsage
public static void disableDeathOnFileUriExposure() 

Source Link

Document

Used by lame internal apps that haven't done the hard work to get themselves off file:// Uris yet.

Usage

From source file:com.android.settings.users.EditUserPhotoController.java

private void cropPhoto(Uri pictureUri) {
    // TODO: Use a public intent, when there is one.
    Intent intent = new Intent("com.android.camera.action.CROP");
    intent.setDataAndType(pictureUri, "image/*");
    appendOutputExtra(intent, mCropPictureUri);
    appendCropExtras(intent);//ww w  . ja v a  2 s. c om
    if (intent.resolveActivity(mContext.getPackageManager()) != null) {
        try {
            StrictMode.disableDeathOnFileUriExposure();
            mFragment.startActivityForResult(intent, REQUEST_CODE_CROP_PHOTO);
        } finally {
            StrictMode.enableDeathOnFileUriExposure();
        }
    } else {
        onPhotoCropped(pictureUri, false);
    }
}