ACTION_VIEW is an entirely different beast from ACTION_SEND (what ShareCompat uses) so it is 100% true that you’ll get a very different set of apps.
However, it isn’t because of the mime type — while setData() does indeed null out the type, as explained in the setDataAndType() Javadoc:
This method should very rarely be used — it allows you to override the MIME type that would ordinarily be inferred from the data with your own type given here.
So in fact the line that isn’t required at all is the setType(getContentResolver().getType(uriToImage)) line — it’ll be automatically inferred by the system when we call setData(). I’ve edited the post to remove the line and comment on why it is not necessary.