import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Build;
import android.view.DisplayCutout;
import com.dogness.platform.utils.AppUtils;
import java.lang.reflect.Method;
/**
* Created by dcg on 2021/9/25
* 检测手机是否是刘海屏
*/
public class NotchInScreen {
/**
* 是否有刘海屏
*
* @return
*/
@SuppressLint("NewApi")
public static boolean hasNotchInScreen(Activity activity) {
// android P 以上有标准 API 来判断是否有刘海屏
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
try {
DisplayCutout displayCutout = activity.getWindow().getDecorView().getRootWindowInsets().getDisplay