startActivityForResult closes immediately

I am developing a chat application, with the option to send pictures and files. The problem is, that when I click on the button to start the startActivityForResult method, the screen turns white for half a second and returns to where I was. I tried this on the android emulator and works fine, but if I try it on my Xiaomi phone doesn't work (it worked weeks before though).

For that I use the following code:

public void onPickPhoto(View view) {
    if (checkPermissionREAD_EXTERNAL_STORAGE(context)) {
        Intent intent = new Intent(context, Chat_PrevisualizarArchivo.class);
        startActivity(intent);
    }
}

That starts a new activity. In the onCreate method of that activity I have the startActivityForResult.

public class Chat_PrevisualizarArchivo extends AppCompatActivity {

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.lay_preview_file);

    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("*/*");
    startActivityForResult(intent,1);
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(data != null) {
        if (requestCode == 1) {
            if (resultCode == Activity.RESULT_OK) {
                Uri selectedFile = data.getData();
                if (selectedFile != null) {
                    filePath = getPath(Chat_PrevisualizarArchivo.this, selectedFile);
                }
                String ext = filePath.substring(filePath.lastIndexOf("."), filePath.length());
            }
        }
    }
}

I've read that this could be because of the activity launch mode, here is my manifest:

    <activity
        android:name=".Chat"
        android:launchMode="singleTop"
        android:parentActivityName=".MainActivity"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".MainActivity" />
    </activity>
    <activity
        android:name=".Chat_PrevisualizarArchivo"
        android:launchMode="singleTop"
        android:parentActivityName=".Chat"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".Chat" />
    </activity>

The log when I press the button:

V/FA: Inactivity, disconnecting from the service
I/Timeline: Timeline: Activity_launch_request time:535826
V/FA: Recording user engagement, ms: 5276
      Connecting to remote service
V/FA: Activity paused, time: 798871
D/FA: Logging event (FE): user_engagement(_e), 
Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=5276, 
firebase_screen_class(_sc)=Chat, 
firebase_screen_id(_si)=4620370960915656203}]
V/FA: onActivityCreated
V/FA: Connection attempt already in progress
I/Timeline: Timeline: Activity_launch_request time:535898
D/FA: Logging event (FE): screen_view(_vs), 
Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=Chat, 
firebase_previous_id(_pi)=4620370960915656203, 
firebase_screen_class(_sc)=Chat_PrevisualizarArchivo, 
firebase_screen_id(_si)=4620370960915656205}]
V/FA: Connection attempt already in progress
      Connection attempt already in progress
      Activity resumed, time: 798938
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 4
I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@22de4a86 
time:535977
V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 88
      Activity paused, time: 798959
D/FA: Logging event (FE): screen_view(_vs), 
Bundle[{firebase_event_origin(_o)=auto, 
firebase_previous_class(_pc)=Chat_PrevisualizarArchivo, 
firebase_previous_id(_pi)=4620370960915656205, 
firebase_screen_class(_sc)=Chat, 
firebase_screen_id(_si)=4620370960915656203}]
I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@3b9d55a7 
time:536254
V/FA: Activity resumed, time: 799233
V/FA: Inactivity, disconnecting from the service
V/FA: Recording user engagement, ms: 30379
V/FA: Connecting to remote service
V/FA: Activity paused, time: 829611
D/FA: Logging event (FE): user_engagement(_e), 
Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=30379, 
firebase_screen_class(_sc)=Chat, 
firebase_screen_id(_si)=4620370960915656203}]
V/FA: Connection attempt already in progress
D/FA: Connected to remote service

Looking at the log I don't know if it has something to do with Firebase, which I use for the messaging part of the app.

Any help would be apreciated, thanks!