ARCore 통화 로깅

Android 앱의 런타임 동작 및 성능 문제를 해결할 때 ARCore API 호출을 Android 기기 로그에 로깅할 수 있습니다.

호출 로깅을 사용 설정하면 ARCore는 앱 빌드에 사용된 SDK에 관계없이 모든 API 호출을 C API 이름으로 로깅합니다. 모든 C API 이름은 C API 참조 문서에서 매개변수 및 반환 값과 함께 확인할 수 있습니다.

API 호출 로깅 사용 설정

*_destroy*_release 함수와 같이 ArSession* 매개변수를 사용하지 않는 ARCore API 호출은 로깅되지 않습니다.

ARCore API 호출 로깅을 사용 설정하려면 다음 단계를 따르세요.

  1. Google Play AR 서비스 (ARCore) 1.23 이상이 설치되어 있는지 확인합니다.

    • Windows의 경우 adb shell pm dump com.google.ar.core | findstr /i "packages: versionName"를 실행합니다.
    • macOS에서 adb shell pm dump com.google.ar.core | egrep -i versionName\|packages:를 실행합니다.
  2. 활성 ARCore 세션이 실행되도록 앱에서 AR 환경을 엽니다. 로깅을 사용 설정하는 브로드캐스트를 수신하려면 앱이 AR 모드에 있어야 합니다. AR 카메라 미리보기 이미지가 기기 화면에 표시되어야 합니다.

  3. 다음 활동 관리자 브로드캐스트 명령어를 사용하여 앱의 통화 로깅을 사용 설정합니다.

    # Enables ARCore call logging and saves a setting to your app's
    # Android Shared Preferences, so that call logging remains enabled in
    # subsequent ARCore sessions.
    
    # Your app must have an actively running ARCore session to receive the broadcast.
    adb shell am broadcast -a com.google.ar.core.ENABLE_API_CALL_LOGGING
    

API 호출 로깅 사용 중지

ARCore API 호출 로깅을 사용 중지하려면 다음 단계를 따르세요.

  1. 활성 ARCore 세션이 실행되도록 앱에서 AR 환경을 엽니다. 로깅을 사용 중지하는 브로드캐스트를 수신하려면 앱이 AR 모드에 있어야 합니다. AR 카메라 미리보기 이미지가 기기 화면에 표시되어야 합니다.

  2. 다음 활동 관리자 브로드캐스트 명령어를 사용하여 앱의 통화 로깅을 사용 중지합니다.

    # Disables ARCore call logging and saves a setting to your app's
    # Android Shared Preferences, so that call logging remains disabled in
    # subsequent ARCore sessions.
    
    # Your app must have an actively running ARCore session to receive the broadcast.
    adb shell am broadcast -a com.google.ar.core.DISABLE_API_CALL_LOGGING
    

출력 보기

ARCore는 모든 ARCore API 로깅 출력에 ARCore-Api 태그를 사용합니다. 이러한 호출만 필터링하려면 다음 명령어를 사용합니다.

# Currently, ARCore only logs API calls that take an `ArSession*` argument.
# Functions that do not take session parameters such as `*_destroy` and `*_release` are not logged.
# -s is equivalent to the filter expression '*:S', which sets priority for all tags to silent.

adb logcat -s ARCore-Api

ARCore는 출력을 제한하여 로그 스팸을 줄입니다. 건너뛴 로그 메시지를 단일 로그 메시지로 집계합니다.

건너뛴 로그 메시지의 출력 예:

D ARCore-Api: ArFrame_create(<ptr>)
D ARCore-Api: ArSession_update(<ptr>) -> AR_SUCCESS
D ARCore-Api: ArFrame_acquireCamera(<ptr>, <ptr>)
D ARCore-Api: ArFrame_getDisplayGeometryChanged(<ptr>, <ptr>)
D ARCore-Api: ArCamera_getTrackingFailureReason(<ptr>, <ptr>)
D ARCore-Api: ArFrame_getTimestamp(<ptr>, <ptr>)
D ARCore-Api: ArSession_setDisplayGeometry(0, 1080, 2195)
D ARCore-Api: ArFrame_create(<ptr>) (suppressing for 10s)
D ARCore-Api: ArSession_update(<ptr>) -> AR_SUCCESS (suppressing for 10s)
D ARCore-Api: ArFrame_acquireCamera(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArFrame_getDisplayGeometryChanged(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArCamera_getTrackingFailureReason(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArFrame_getTimestamp(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArSession_setDisplayGeometry(0, 1080, 2195) (suppressing for 10s)