Buggy code:
public class VectorSettingsPreferencesFragment extends PreferenceFragment { private static final String ARG_MATRIX_ID = "VectorSettingsPreferencesFragment.ARG_MATRIX_ID" ; private MXSession mSession ; private View mLoadingView ; private static HashMap < String , String > mPushesRuleByResourceId = null ; private IMXNetworkEventListener mNetworkListener = new IMXNetworkEventListener ( ) { @ Override public void onNetworkConnectionUpdate ( boolean isConnected ) { } } ; private MXEventListener mEventsListener = new MXEventListener ( ) { @ Override public void onBingRulesUpdate ( ) { } @ Override public void onAccountInfoUpdate ( MyUser myUser ) { } } ; public static VectorSettingsPreferencesFragment newInstance ( String matrixId ) { } @ Override public void onCreate ( final Bundle savedInstanceState ) { } @ Override public void onPause ( ) { } @ Override public void onResume ( ) { } private void displayLoadingView ( ) { } private void hideLoadingView ( ) { } private void hideLoadingView ( Boolean refresh ) { } private void refreshPreferences ( ) { } private void refreshDisplay ( ) { } private void onPasswordUpdateClick ( ) { } private void onPushRuleClick ( final String fResourceText ) { } private void onDisplayNameClick ( String value ) { } private void onUpdateAvatarClick ( ) { } @ Override public void onActivityResult ( int requestCode , int resultCode , final Intent data ) { super . onActivityResult ( requestCode , resultCode , data ) ; if ( resultCode == ( Activity . RESULT_OK ) ) { if ( null != data ) { Uri thumbnailUri = null ; if ( null != data ) { ClipData clipData = null ; if ( ( VERSION . SDK_INT ) >= ( VERSION_CODES . JELLY_BEAN_MR2 ) ) { clipData = data . getClipData ( ) ; } if ( null != clipData ) { if ( ( clipData . getItemCount ( ) ) > 0 ) { thumbnailUri = clipData . getItemAt ( 0 ) . getUri ( ) ; } } else if ( null != ( data . getData ( ) ) ) { thumbnailUri = data . getData ( ) ; } } Bitmap thumbnail = null ; if ( null != thumbnailUri ) { <START_BUG> thumbnail = VectorUtils . getBitmapFromuri ( getActivity ( ) , thumbnailUri ) ; <END_BUG> } String thumbnailURL = mSession . getMediasCache ( ) . saveBitmap ( thumbnail , null ) ; if ( null != thumbnailURL ) { displayLoadingView ( ) ; ResourceUtils . Resource resource = ResourceUtils . openResource ( getActivity ( ) , Uri . parse ( thumbnailURL ) ) ; mSession . getContentManager ( ) . uploadContent ( resource . contentStream , null , resource . mimeType , null , new ContentManager . UploadCallback ( ) { @ Override public void onUploadStart ( String uploadId ) { } @ Override public void onUploadProgress ( String anUploadId , int percentageProgress ) { } @ Override public void onUploadComplete ( final String anUploadId , final ContentResponse uploadResponse , final int serverReponseCode , final String serverErrorMessage ) { getActivity ( ) . runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { if ( ( null != uploadResponse ) && ( null != ( uploadResponse . contentUri ) ) ) { mSession . getMyUser ( ) . updateAvatarUrl ( uploadResponse . contentUri , new org . matrix . androidsdk . rest . callback . ApiCallback < Void > ( ) { @ Override public void onSuccess ( Void info ) { hideLoadingView ( true ) ; } @ Override public void onNetworkError ( Exception e ) { hideLoadingView ( false ) ; } @ Override public void onMatrixError ( MatrixError e ) { hideLoadingView ( false ) ; } @ Override public void onUnexpectedError ( Exception e ) { hideLoadingView ( false ) ; } } ) ; } else { hideLoadingView ( false ) ; } } } ) ; } } ) ; } } } } }

Fix:
thumbnail = VectorUtils . getThumbnailBitmapFromUri ( getActivity ( ) , thumbnailUri , mSession . getMediasCache ( ) ) ;