Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Framework Code Readingのしおり ver 1.2

operandoOS
November 10, 2016

Android Framework Code Readingのしおり ver 1.2

Android Framework Code Readingのしおり ver 1.2

operandoOS

November 10, 2016
Tweet

More Decks by operandoOS

Other Decks in Technology

Transcript

  1. Android Framework

    Code Readingͷ͓͠Γ
    ver 1.2

    View full-size slide

  2. ໨ඪ
    • ಡΈ࢝ΊΔʹ͸Ͳ͔͜Β୳ͤ͹͍͍ͷ͔Θ͔Δ
    • Android Frameworkͷίʔυ͕ͳΜͱͳ͘

    ಡΊΔΑ͏ʹͳΔ
    • ΋͏Androidා͘ͳ͍ (ʆŋωŋ´)

    View full-size slide

  3. ༻ҙ͢Δ΋ͷ

    View full-size slide

  4. ༻ҙ͢Δ΋ͷ
    • ͓޷ΈͷEditor
    • OpenGrok
    • https://sites.google.com/site/devcollaboration/codesearch
    • ΫιίʔυಡΜͰ΋Ί͛ͳ͍ؾ࣋ͪ
    • جຊ͜Ε͚ͩ

    View full-size slide

  5. ಡΈ΍͍͢؀ڥΛ࡞Δ
    • FirefoxͷπϦʔܕλϒͱ͍͏֦ு͕Φεεϝ
    • https://addons.mozilla.org/ja/firefox/addon/
    tree-style-tab/
    • ಡΜͰ͍Δίʔυͷϝιουݺͼग़͠ͷ֊૚
    ͱ͔؅ཧ͠΍͍͢

    View full-size slide

  6. ಡΈ΍͍͢؀ڥΛ࡞Δ
    ͜Μͳײ͡ʔ

    View full-size slide

  7. OpenGrok
    • ιʔείʔυΛϒϥ΢βͰӾཡͰ͖Δ΋ͷ
    • method΁ͷϦϯΫͱ͔షͬͯ͋ͬͯศརʂʂ
    • Androidͷιʔείʔυ΋OpenGrokԽͯ͋͠Γ·͢
    • ιʔείʔυखݩʹͳͯ͘΋ಡΊͯศརʂʂ

    View full-size slide

  8. OpenGrokʹ׳ΕΔ

    View full-size slide

  9. OpenGrokʹ׳ΕΔ
    • Full SearchΛࢦఆ͢Δ
    • File PathΛࢦఆ͢Δ
    • جຊ্̎ͭͰ͍͍ͩͨOK
    • ࠔͬͨΒHelpΛݟͯ࢖͍ํΛϚελʔ͢Δ
    • http://tools.oesf.biz/android-6.0.0_r1.0/help.jsp

    View full-size slide

  10. खݩʹίʔυΛμ΢ϯϩʔυ͢Δ
    • શ෦ͷιʔείʔυΛμ΢ϯϩʔυ͢Δͷ͸େม
    • OpenGrok͔ΒFile୯ҐͰμ΢ϯϩʔυͰ͖Δ
    • Α͘ࢀর͢ΔϑΝΠϧ͸μ΢ϯϩʔυ͓ͯ͘͠ͱศར
    • URLͷxrefͱrawʹͯ͠ΞΫηε͢ΔͱBrowser

    ܦ༝Ͱμ΢ϯϩʔυͰ͖Δ͸ͣ

    View full-size slide

  11. खݩʹίʔυΛμ΢ϯϩʔυ͢Δ
    http://tools.oesf.biz/android-6.0.0_r1.0/xref/
    frameworks/base/core/java/android/app/Activity.java
    http://tools.oesf.biz/android-6.0.0_r1.0/raw/frameworks/
    base/core/java/android/app/Activity.java

    View full-size slide

  12. ҙ֎ͱखݩʹ͍࣋ͬͯΔιʔείʔυ
    • Android SDK Manager͔ΒऔಘͰ͖Δ΋ͷ
    • /Applications/Android Studio.app/sdk/sources
    • /Applications/Android Studio.app/sdk/extras/
    android/support
    • /Applications/Android Studio.app/sdk/extras/
    android/m2repository/com/android/support

    View full-size slide

  13. खܰʹಡΊͦ͏ͳͱ͜Ζ
    • frameworks/
    • Android Frameworksશൠͷίʔυ
    • frameworks/base/core/java/
    • Android SDKશൠͷίʔυ

    View full-size slide

  14. खܰʹಡΊͦ͏ͳͱ͜Ζ
    • packages/apps/
    • γεςϜΞϓϦશൠͷίʔυ
    • http://tools.oesf.biz/android-6.0.0_r1.0/xref/
    packages/apps/Settings/
    • SettingsΞϓϦͷίʔυ(Φεεϝʂ)

    View full-size slide

  15. ໾ʹཱͪͦ͏ͳϦϯΫ·ͱΊͯ·͢
    https://github.com/AndroidFrameworkCodeReading/
    Android-Framework-Code-Reading

    View full-size slide

  16. GopenGrok
    https://github.com/operando/gopen-grok
    ίϚϯυϥΠϯ͔ΒOpenGrokͷ

    ݕࡧ͕Ͱ͖Δπʔϧ

    View full-size slide

  17. GopenGrok
    https://github.com/operando/gopen-grok
    $ gopen-grok -s Activity

    View full-size slide

  18. GopenGrok
    https://github.com/operando/gopen-grok

    View full-size slide

  19. GopenGrok Install
    https://github.com/operando/gopen-grok
    $ go get -d github.com/operando/gopen-grok
    $ go install github.com/operando/gopen-grok

    View full-size slide

  20. LogcatٯҾ͖

    View full-size slide

  21. LogcatٯҾ͖
    • LogcatʹྲྀΕ͍ͯΔϩά͸ίʔυ্ʹ

    ॻ͍ͯ͋Δ͸ͣ(ಈతͳ΋ͷҎ֎
    • ௐ΂͍ͨػೳͬΆ͍΋ͷ͕ྲྀͯ͠ΔLogcat͔Β
    ಛఆͷΩʔϫʔυͰݕࡧΛ͔͚Δ

    View full-size slide

  22. LogcatٯҾ͖
    • ྫ͑͹ɺҎԼͷϩάͷgetDirectorySizeͬͯͲ
    ͏΍ͬͯௐ΂ͯΔ͔஌Γ͍ͨʂͱͯ͠…

    View full-size slide

  23. LogcatٯҾ͖
    • ͡ΌͱΓ͋͑ͣʮgetDirectorySizeʯͬͯ

    ΩʔϫʔυͰOpenGrokݕࡧ͢Δ

    View full-size slide

  24. ʮgetDirectorySizeʯͷݕࡧ݁Ռ
    ݟࣄʹͦΕͬΆ΋ͷ

    Ҿ͔͔ͬͬͨ

    View full-size slide

  25. ίʔυΛݟΔͱ͜Μͳײ͡
    • IMediaContaninerServiceͶʔ΁ʔ
    • LogcatʹྲྀΕͯͨͷ͸ 438ߦ໨ͷ΍ͭ

    View full-size slide

  26. LogcatٯҾ͖
    • ͏·͘ώοτ͢Ε͹࠷ߴͷٕ
    • Ͳͷϩά͕ྑͦ͞͏͔ݟۃΊΔͷ͸৬ਓٕ
    • LogcatʹྲྀΕ͍ͯΔϝοηʔδ͕੩తͳ΋ͷ͔
    ಈతͳ΋ͷ͔൑அ͢Δͷ͸৬ਓٕ

    View full-size slide

  27. ͋ͱͰݟฦ͢Α͏ʹ͜͏ॻ͘ͱ͍͍͔΋
    λΠτϧ

    ݟग़͠

    View full-size slide

  28. ͋ͱͰݟฦ͢Α͏ʹ͜͏ॻ͘ͱ͍͍͔΋
    Θ͔ͬͨ͜ͱΛ

    Օ৚ॻ͖

    View full-size slide

  29. ͋ͱͰݟฦ͢Α͏ʹ͜͏ॻ͘ͱ͍͍͔΋
    ॏཁͳͱ͜Ζ͸

    ίʔυͷURLͱ࣮ࡍͷίʔυΛ

    ίϐϖͯ͠ॻ͍͓ͯ͘

    View full-size slide

  30. ͋ͱͰݟฦ͢Α͏ʹ͜͏ॻ͘ͱ͍͍͔΋
    • Markdownͱ͔Ͱద౰ʹॻ͘
    • ίʔυͷURL͸ΊͬͪΌେࣄ
    • ॻ͍ͨΒGithub΍Gistʹஔ͍͓ͯ͘ͱ

    ݕࡧ΋Ͱָ͖ͯ

    View full-size slide

  31. JobScheduler-Code-Reading
    https://github.com/operando/JobScheduler-Code-Reading
    ·ͱΊํͷࢀߟʹͲ͏ͧʔ

    View full-size slide