This topic has been discussed in lots of questions here, with mostly different results and, due to API changes and different types of URIs, no definitive answer
Don't use EXIF. You can get orientation of image from Uri like this:
private static int getOrientation(Context context, Uri photoUri) {
Cursor cursor = context.getContentResolver().query(photoUri,
new String[]{MediaStore.Images.ImageColumns.ORIENTATION}, null, null, null);
if (cursor.getCount() != 1) {
cursor.close();
return -1;
}
cursor.moveToFirst();
int orientation = cursor.getInt(0);
cursor.close();
cursor = null;
//orientation here can be 90, 180, 270!
}