רישום שיחות ב-ARCore

כדי לפתור בעיות שקשורות להתנהגות ולביצועים בזמן ריצה באפליקציה ל-Android, אפשר לרשום קריאות ל-ARCore API ביומן מכשירי Android.

כשמפעילים רישום שיחות, ARCore יתעד את כל הקריאות ל-API באמצעות השם C API, בלי קשר ל-SDK שבאמצעותו האפליקציה נוצרה. כל השמות של C API מופיעים במסמכי התיעוד של C API, לצד הפרמטרים והערכים המוחזרים שלהם.

הפעלת רישום קריאות ל-API

קריאות ל-ARCore API שלא מקבלות פרמטרים של ArSession*, כמו הפונקציות *_destroy ו-*_release, לא נרשמות ביומן.

כדי להפעיל את רישום השיחות ב-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. צריך לפתוח את חוויית ה-AR באפליקציה כדי שיתחיל סשן פעיל של ARCore. האפליקציה חייבת להיות במצב 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. צריך לפתוח את חוויית ה-AR באפליקציה כדי שיתחיל סשן פעיל של ARCore. האפליקציה חייבת להיות במצב 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)