getStatusBarStableInsets

Returns the status bar stable insets.

상태 바의 stable insets를 반환합니다.

What are insets / Insets란:
Insets represent the space occupied by system UI elements from each screen edge. For status bar at the top, if it's 50px tall, top inset is 50. See getNavigationBarStableInsets for more details about insets concept.

Insets는 각 화면 가장자리로부터 시스템 UI 요소가 차지하는 공간을 나타냅니다. 상단 상태 바가 50px 높이면, top inset은 50입니다. insets 개념에 대한 자세한 내용은 getNavigationBarStableInsets을 참조하세요.

API version differences / API 버전별 차이:

  • API 30+ (R): Uses WindowInsets.Type.statusBars() to get all directional insets. In practice, only top has a meaningful value (status bar height), while bottom, left, right are typically 0.

  • API 28-29: Uses rootWindowInsets.stableInsetTop for status bar height. Only top is set; bottom, left, right are explicitly 0 since status bar only appears at the top.

  • API 30+ (R): WindowInsets.Type.statusBars()를 사용하여 모든 방향의 insets를 가져옵니다. 실제로는 top만 의미 있는 값(상태 바 높이)을 가지며, bottom, left, right는 일반적으로 0입니다.

  • API 28-29: rootWindowInsets.stableInsetTop을 사용하여 상태 바 높이를 가져옵니다. top만 설정되고 bottom, left, right는 명시적으로 0입니다. 상태 바는 상단에만 나타나기 때문입니다.

Return

DisplayInfoBarInsets(top, bottom, left, right) or null if unavailable.
- (0, 0, 0, 0): Measured successfully but no reserved status-bar area exists.
- null: WindowInsets not yet received (called too early) or measurement unavailable.

DisplayInfoBarInsets(top, bottom, left, right) 또는 사용 불가능한 경우 null을 반환합니다.
- (0, 0, 0, 0): 측정은 성공했지만 상태 바 점유 영역이 없는 경우입니다.
- null: WindowInsets 미수신(너무 이른 호출) 또는 측정 불가입니다.

Parameters

activity

Activity instance required for API 28-29 to access window.decorView.rootWindowInsets for app window-based insets. For API 30+, this parameter is ignored as currentWindowMetrics.windowInsets is used instead. Pass null if Activity is unavailable (returns null for API 28-29, valid insets for API 30+).

API 28-29에서 앱 윈도우 기준 insets를 얻기 위해 window.decorView.rootWindowInsets 접근에 필요한 Activity 인스턴스입니다. API 30+에서는 currentWindowMetrics.windowInsets를 사용하므로 이 파라미터는 무시됩니다. Activity를 사용할 수 없는 경우 null을 전달하면 API 28-29에서는 null을 반환하고, API 30+에서는 정상적인 insets를 반환합니다.