add api check around setLayoutDirection