In api level 30 defaultDisplay is deprecated. So we need to use currentWindowMetrics. But there is no any getRealSize method in it. What will be equivalent to code: