Handle Display Cutouts (API 28+)
masterTo prevent the FloatingView from being obscured by display cutouts (notches), use FloatingViewManager.findCutoutSafeArea(activity) to calculate a safe area and pass it to your service.
Note: The Activity must be in portrait orientation and windowLayoutInDisplayCutoutMode must not be set to never.
// 1. In your Activity/Fragment, find the safe area and pass it via Intent
final Intent intent = new Intent(activity, ChatHeadService.class);
intent.putExtra(ChatHeadService.EXTRA_CUTOUT_SAFE_AREA, FloatingViewManager.findCutoutSafeArea(activity));
ContextCompat.startForegroundService(activity, intent);
// 2. In your Service, apply the safe area to the manager
Rect safeArea = (Rect) intent.getParcelableExtra(EXTRA_CUTOUT_SAFE_AREA);
mFloatingViewManager.setSafeInsetRect(safeArea);