For some technical reasons, I cannot use Android File Picker to get a file and their content into my application. That's why I came up with a solution which queries intents and processes the results on my own UI.
Here is how I get the list of applications with Intent.ACTION_GET_CONTENT
/* Create a new Intent to Read a File */
Intent documentIntent = new Intent(Intent.ACTION_GET_CONTENT);
documentIntent.setType((action == ACTION_SELECT_FILE) ? "*/*" : "image/*");
/* Query for Applications to see which are available */
List<ResolveInfo> appList = getActivity().getPackageManager().queryIntentActivities(documentIntent, PackageManager.MATCH_DEFAULT_ONLY);
This works fine and lists the applications which can handle my request.
But I'm working with Android for Work and when I execute the code above, I only get the list of applications available to Work Profile, which is expected.
But one of the results which is returned from the code above is "Switch to Personal" which lists applications installed in Personal Account in Android File Picker.
So the question is, how can I get the same behavior? How can I Query Intent Activities from Personal Profile?