Save 37% off PRO during our Black Friday Sale! »

できる!Android Framework Code Reading

E77b6a5f919f7366d94f21eee9a014f5?s=47 operandoOS
October 21, 2021

できる!Android Framework Code Reading

E77b6a5f919f7366d94f21eee9a014f5?s=128

operandoOS

October 21, 2021
Tweet

Transcript

  1. Ͱ͖Δʂ 
 Android Framework 
 Code Reading DroidKaigi 2021 Day

    3
  2. • Shinobu Okano • @operandoOS / shinobu.dart • 10X, Inc.

    / Software Engineer • Flutter / Dart / Android / Automation ࣗݾ঺հ
  3. 10X, Inc. - Stailer https://stailer.jp/

  4. We are waiting for YOU! https://jobs.10x.co.jp/

  5. ͜ͷηογϣϯͷΰʔϧ • Android Frameworkͷίʔυ͕ͳΜͱͳ͘ಡΊΔΑ͏ʹͳΔ • πʔϧΛར༻ͯ͠ಡΈ͍ͨίʔυΛݟ͚ͭΒΕΔΑ͏ʹͳΔ • Android Frameworkͷίʔυ͕ಡΈͨ͘ͳΔʂ

  6. Android Framework 
 ͬͯͳʹʁ

  7. Android software stack • ͬ͘͟ΓݴͬͯAndroid OSΛߏ੒͍ͯ͠Δ΋ͷ • ͍͔ͭ͘ͷLayerͰ෼͔Ε͍ͯΔ • Android

    system architectureͱදݱ͞ΕΔ͜ͱ΋͋Δ • ͱʹ͔͘޿͍ɾͰ͔͍ɾਂ͍ɾ΍͹͍
  8. https://source.android.com/index.html https://source.android.com/setup/intro Android software stack

  9. • શLayerͷιʔείʔυ͕΄΅OSSͱͯ͠ެ։͞Ε͍ͯΔͷͰಡΊΔ • Kotlin/JavaͰΞϓϦ։ൃ͍ͯ͠Δਓ͕ؾܰʹಡΊΔͷ͸ Android Framework Layer • Android Framework

    Layer͸͓͓͔ͨJavaͰॻ͔Ε͍ͯΔ • ͦΕΑΓԼͷLayer͸C/C++ɺRustͳͲͰॻ͔Ε͍ͯΔ Android software stack
  10. ຊࢿྉʹ͓͚ΔAndroid Framework • Android Framework = Android software stack ͱ͍͏

    
 Ґஔ͚ͮͰॻ͍͍ͯ·͢ • ͨͩ͠ຊࢿྉͰ঺հ͢Δ͜ͱ͸্ҐϨΠϠʔ޲͚ͷ 
 Code ReadingΛϝΠϯλʔήοτͱ͍ͯ͠·͢
  11. Android FrameworkͷίʔυΛಡΉཧ༝ • ಡΉ͜ͱͰ಺෦ͷ࢓૊ΈΛཧղ͠ɺΞϓϦ։ൃ౳ʹ໾ཱͯΔ • ͳΜͱͳ͘಺෦ͷ࢓૊Έ஌Γ͍ͨͳʔͱ͍͏ڵຯ͕༙͍ͯ 
 ͠·͏͔Β • ָ͍͔͠Β☺

  12. Android Framework 
 Code ReadingΛ͢Δ্Ͱ 
 ศརͳαΠτɾπʔϧͷ঺հ

  13. Android Code Search “Code Search with Cross References for the

    Android Open Source Project” https://android-developers.googleblog.com/2019/12/code- search-with-cross-references-for-aosp.html
  14. Android Code Search https://cs.android.com/

  15. Android Code Search(ACS) • ϒϥ΢β্ͰAndroid FrameworkͷίʔυΛݕࡧɾӾཡ 
 Ͱ͖ΔαΠτ • ίʔυྔ͕๲େͳAndroid

    FrameworkͷίʔυΛಡΉ্Ͱ ඞਢπʔϧ • Google͕ӡӦΛ͍ͯ͠Δ
  16. Android Code Searchͷ͍͢͝ͱ͜Ζ • ݕࡧͷϑΟϧλʔ͕๛෋ • ߦ਺͕ଟ͍ίʔυͰ΋αΫαΫදࣔ͞ΕΔ • ϒϥϯνͷ੾Γସ͕͑Ͱ͖Δ •

    ૬ޓࢀরͷϦϯΫ͕షΒΕ͍ͯΔ • ϝιουͷ֊૚ݺͼग़͠ɺࢀর͕Θ͔Δ • Ξ΢τϥΠϯΊͪΌศརʂ
  17. ݕࡧͷϑΟϧλʔ͕๛෋ • ໨తͷίʔυΛ୳ͨ͢Ίʹ໾ཱͭϑΟϧλʔ͕͍ͬͺ͍ • ݕࡧ૭ͰϑΟϧλʔͷSyntaxΛิ׬ͯ͘͠ΕΔ • Syntax reference • https://developers.google.com/code-search/reference

  18. ߦ਺͕ଟ͍ίʔυͰ΋αΫαΫදࣔ͞ΕΔ • 1ສߦ͘Β͍ͷίʔυͳΒಡΈࠐΈ΋දࣔ΋αΫαΫ • ࢼ͠ʹIntent.javaΛ։͍ͯΈͯʂ • https://cs.android.com/android/platform/ superproject/+/master:frameworks/base/core/java/ android/content/Intent.java

  19. ϒϥϯνͷ੾Γସ͕͑Ͱ͖Δ • ಛఆOSόʔδϣϯͷಈ࡞Λௐ΂͍ͨ࣌ʹศར • ݹ͍OSόʔδϣϯͷϒϥϯν΋͋Δ • ίʔυΛ։͍ͨ··ϒϥϯν੾Γସ͑Ͱɺ੾Γସ͑ઌͷ 
 όʔδϣϯͷίʔυʹมΘΔ •

    ͦͷ͏ͪAndroid 12ͷϒϥϯν΋ग़Δ͸ͣ
  20. ϒϥϯνͷ੾Γସ͕͑Ͱ͖Δ

  21. ૬ޓࢀরͷϦϯΫ͕షΒΕ͍ͯΔ • ϝιουɾΫϥεͳͲ΁ͷδϟϯϓ͕Ͱ͖Δ • ίʔυʹϦϯΫ͕షΒΕ͍ͯΔͷͰͦΕΛΫϦοΫ͢Δ͚ͩ • ͢΂ͯͷίʔυʹ૬ޓࢀরͷϦϯΫ͕͋ΔΘ͚͡Όͳ͍ 
 ͷͰ஫ҙ

  22. ૬ޓࢀরͷϦϯΫ͕షΒΕ͍ͯΔ https://cs.android.com/android/platform/superproject/+/android-11.0.0_r40:frameworks/base/core/java/android/app/ Activity.java;l=5070

  23. ૬ޓࢀরͷϦϯΫ͕షΒΕ͍ͯΔ https://cs.android.com/android/platform/superproject/+/android-11.0.0_r40:frameworks/base/core/java/android/app/ Activity.java;drc=55d98d2ba142d6c35894b1092397e2b5a70bc2e8;l=3440

  24. ϝιουͷ֊૚ݺͼग़͠ɺࢀর͕Θ͔Δ https://cs.android.com/android/platform/superproject/+/android-11.0.0_r40:frameworks/base/core/java/android/database/ sqlite/SQLiteDatabase.java;l=830;bpv=1;bpt=1

  25. ఆ਺΋ࢀর͞Ε͍ͯΔՕॴ͕Θ͔Δ https://cs.android.com/android/platform/superproject/+/android-11.0.0_r40:frameworks/base/core/java/android/database/ sqlite/SQLiteGlobal.java;l=46;bpv=1;bpt=0

  26. • Ϋϥεʹఆٛͯ͋͠Δ 
 ఆ਺ɺϝιουͳͲ͕ 
 ҰཡͰݟΕΔ Ξ΢τϥΠϯΊͪΌศརʂ

  27. • ϑΟϧλʔ΋Ͱ͖Δʂ Ξ΢τϥΠϯΊͪΌศརʂ

  28. • ΩʔϘʔυૢ࡞͚ͩͰ΋ ͋Δఔ౓࢖͑ΔΑ͏ʹ 
 ߟྀ͞Εͯͦ͏ ΩʔϘʔυγϣʔτΧοτ

  29. • ৭ʑม͑ΒΕΔ • ݕࡧ݁Ռ݅਺૿΍͢ͷ 
 ͓͢͢Ί • ࣗ෼ʹ߹ͬͨίʔυͷ 
 ϑΥϯταΠζʹมߋ͢Δ

    Android Code Searchͷઃఆ
  30. Android Code Search ૢ࡞σϞ • ࣮ࡍʹૢ࡞ͯ͠Δͱ͜ΖΛσϞ͠·͢ • ͥͻΈͳ͞Μ΋͓ࢼ͍ͩ͘͠͞ʂʂ • https://cs.android.com/

  31. “Code Search for Google open source projects” https://opensource.googleblog.com/2020/04/code-search-for- google-open-source.html Code

    Search͸Android͚ͩ͡Όͳ͍ʂ
  32. ͜Μͳʹ͍ͬͺ͍ʂʂ https://cs.opensource.google/

  33. Chromium΋͋Δ https://source.chromium.org/chromium

  34. AOSP WebαΠτ • AOSP(Android Open Source Project) • https://source.android.com/index.html •

    Androidͷ৭Μͳ͜ͱ͕υΩϡϝϯτͰ·ͱ·ͬͯΔ • ڵຯ͋ΔςʔϚΛݟ͚ͭͯಡΜͰΈΔͷ͕͓͢͢Ί
  35. adb(Android Debug Bridge) • ৭ʑศརͳadbίϚϯυ • ୺຤ͷঢ়ଶΛ೺Ѳɾૢ࡞͢Δ্Ͱඞਢͳπʔϧ • ࠓճ͸Code Reading͢Δࡍʹɺݸਓతʹར༻ස౓͕

    
 ߴ͍ίϚϯυͷΈ঺հ
  36. adb(Android Debug Bridge) • adbͷৄࡉ΍ઃఆͳͲ͸ҎԼͷϦϯΫΛݟ͍ͯͩ͘͞ • https://developer.android.com/studio/command-line/ adb

  37. Logcat • AndroidγεςϜ͕ॻ͖ग़ͨ͠ϩάΛग़ྗ͢Δπʔϧ • ϩά͸Code Readingʹ໾ཱͭૉࡐͷҰͭ

  38. “Android Logging System” https://elinux.org/Android_Logging_System Logcat

  39. • جຊ͜ΕɻΦϓγϣϯ͸ඞཁʹͳͬͨΒ࢖͏ɻ Α͘࢖ͬͯΔLogcatίϚϯυྫ > ~ adb logcat -v time

  40. • mainҎ֎ͷϩά͕ݟ͍ͨ৔߹ʹ͸ -b Α͘࢖ͬͯΔLogcatίϚϯυྫ > ~ adb logcat -v time

    -b system
  41. LogcatΛදࣔͭͭ͠ϑΝΠϧʹॻ͖ࠐΉ • ϩάΛޙʑ·ͨݟ͍ͨ৔߹ʹศར • aliasʹ͓ͯ͘͠ͱ͍͍ > ~ adb logcat -v

    time | tee logcat_main_$ (date +"%Y%m%d-%H%M%S").log
  42. “Logcat command-line tool” https://developer.android.com/studio/command-line/logcat LogcatͷΦϓγϣϯʹ͍ͭͯৄ͘͠

  43. • ϩάόοϑΝͷαΠζΛ 
 େ͖͘͢Δ • ϩά͕ྲྀΕͯফ͑ͯ͠·͏ ͷΛܰݮͰ͖Δ • ։ൃऀ޲͚Φϓγϣϯ͔Β มߋͰ͖Δ

    Logcatͷ͓͢͢Ίઃఆ
  44. Logcatͷ࣮૷ • ͜͜ • https://cs.android.com/android/platform/ superproject/+/master:system/logging/logcat/

  45. dumpsys • γεςϜαʔϏεͷঢ়ଶΛग़ྗ͢Δπʔϧ • γεςϜαʔϏεؔ࿈ͷCode ReadingΛ͢Δࡍʹศར • ΞϓϦ։ൃ࣌ʹ΋໾ཱͭ • https://developer.android.com/studio/command-line/

    dumpsys
  46. dumpsys • جຊతʹग़ྗ͍ͨ͠γεςϜαʔϏεΛࢦఆ͢Δ > ~ adb shell dumpsys <service>

  47. “pecoΛ࢖ͬͯಛఆͷγεςϜαʔϏεͷ dumpsysΛ؆୯ʹ͢Δ” https://qiita.com/operandoOS/items/ 15bc6d1053d3ab31b300 dumpsys

  48. bugreport • ৭Μͳϩά͔ΒCode ReadingͷώϯτΛಘΔ৔߹ʹศར • औಘͰ͖Δϩάͷ਺͸ΊͬͪΌଟ͍ > ~ adb bugreport

  49. “Reading Bug Reports” https://source.android.google.cn/setup/contribute/read-bug- reports bugreport

  50. • DroidKaigi 2017Ͱͻͨ͢ Βadbʹ͍ͭͯ࿩ͨ͠ͷͰ ڵຯ͋Δํ͸ͥͻʂ • https://speakerdeck.com/ operando/ komantonasitehokuhaan droidkai-fa-tekinaihua-1

    ͦͷଞͷadbίϚϯυʹ͍ͭͯ
  51. ಡΈ͍ͨ໨తͷίʔυʹ 
 ͨͲΓணٕ͘ज़

  52. ಡΈ͍ͨ໨తͷίʔυʹͨͲΓணٕ͘ज़ • Android Framework͸ίʔυྔ͕๲େͳͷͰద౰ʹ୳ͯ͠ ΋ಡΈ͍ͨ໨తͷίʔυʹͨͲΓண͚ͳ͍😭 • ͖͞΄Ͳ঺հͨ͠αΠτ΍πʔϧΛར༻ͯ͠ 
 ಡΈ͍ͨ໨తͷίʔυʹͨͲΓண͘ํ๏ͷྫΛ঺հ

  53. ಡΈ͍ͨ໨తͷίʔυʹͨͲΓணٕ͘ज़ • Android Code SearchͷݕࡧΛ࢖͏ • LogcatͳͲγεςϜ͕ग़ྗ͢ΔϩάΛ࢖͏ • ΞϓϦ্ʹදࣔ͞ΕΔจࣈྻΛ࢖͏

  54. ಡΈ͍ͨ໨తͷίʔυʹͨͲΓணٕ͘ज़ • Android Code SearchͷݕࡧΛ࢖͏ • LogcatͳͲγεςϜ͕ग़ྗ͢ΔϩάΛ࢖͏ • ΞϓϦ্ʹදࣔ͞ΕΔจࣈྻΛ࢖͏

  55. Android Code SearchͷݕࡧΛ࢖͏ • ಡΈ͍ͨ໨తͷίʔυʹؔ࿈ͦ͠͏ͳϫʔυͰݕࡧ͢Δ • ͳΜͱͳ͘໨తͷίʔυͷ໨੕͕෇͍ͯΔ৔߹͸ 
 ͜Ε͕Ұ൪ૣ͍͔΋ •

    ݕࡧ݁Ռ͕ଟ͗͢Δ৔߹͸ɺݕࡧϑΟϧλʔΛ׆༻ͯ͠ 
 ݅਺Λߜ͍ͬͯ͘
  56. • ͖͞΄Ͳ঺հͨ͠Logcat ͷϩάόοϑΝαΠζΛ 
 ม͑Δ࣮૷Λ୳ͨ͠ྫ • languageϑΟϧλʔ͸ 
 ͓͢͢Ί ݕࡧϑΟϧλʔΛ׆༻ͯ݅͠਺ΛߜΔ

  57. “Rust in the Android platform” https://security.googleblog.com/2021/04/rust-in-android- platform.html AndroidͷRustͬͯͲ͜Ͱ࢖ΘΕͯΔͷʁ

  58. AndroidͷRustͬͯͲ͜Ͱ࢖ΘΕͯΔͷʁ

  59. ಡΈ͍ͨ໨తͷίʔυʹͨͲΓணٕ͘ज़ • Android Code SearchͷݕࡧΛ࢖͏ • LogcatͳͲγεςϜ͕ग़ྗ͢ΔϩάΛ࢖͏ • ΞϓϦ্ʹදࣔ͞ΕΔจࣈྻΛ࢖͏

  60. LogcatͳͲγεςϜ͕ग़ྗ͢ΔϩάΛ࢖͏ • खࠒͳͷ͸Logcatͷग़ྗΛ࢖͏΍Γํ • γεςϜ͕ग़ྗ͢Δϩά = ϩάग़ྗͷίʔυ͕ଘࡏ͢Δ • ग़ྗ͍ͯ͠ΔίʔυʹͨͲΓண͖ɺͦͷपลͷίʔυ͔Β ໨తͷίʔυ΁ͨͲΓண͚Δ͔୳͢

  61. ͜ΜͳखॱͰϩάΛ࢖ͬͯίʔυΛ୳͢ 1. ಡΈ͍ͨ໨తͷίʔυʹؔ࿈͢Δૢ࡞Λߦ͏ 2. ૢ࡞1ʹΑΓग़ྗ͞ΕͨLogcat͔ΒಡΈ͍ͨίʔυʹ 
 ؔ࿈͢ΔϩάΛ୳͢ 3. ݟ͚ͭͨϩά͔ΒݻఆจࣈྻΛ୳͢ 4.

    ݟ͚ͭͨจࣈྻΛAndroid Code Search(ACS)Ͱݕࡧ͢Δ
  62. ͜ΜͳखॱͰϩάΛ࢖ͬͯίʔυΛ୳͢ • ʮΞϓϦ͕ΞϯΠϯετʔϧ͞ΕΔ࣌ʹߦΘΕ͍ͯΔ͜ͱʯ ΛಡΈ͍ͨ໨తͷίʔυͱͯ͠ɺ۩ମతʹखॱΛઆ໌ • ࢿྉΛݟͳ͕ΒΈͳ͞ΜͷखݩͰ࣮ࡍʹ΍ͬͯΈΔ͜ͱΛ 
 ͓͢͢Ί͠·͢

  63. 1. ಡΈ͍ͨ໨తͷίʔυʹؔ࿈͢Δૢ࡞Λߦ͏ • ૢ࡞࣌ͷϩά͕ݟ͍ͨͷͰɺLogcatίϚϯυΛ࣮ߦ͓ͯ͘͠ > ~ adb logcat -v time

  64. • ʮΞϓϦ͕ΞϯΠϯετʔϧ͞ ΕΔ࣌ʹߦΘΕ͍ͯΔ͜ͱʯΛ ஌Γ͍ͨͷͰɺ୺຤͔Βద౰ʹ ΞϓϦΛΞϯΠϯετʔϧ͢Δ • ͜Ε͕ʮಡΈ͍ͨ໨తͷίʔυ ʹؔ࿈͢Δૢ࡞ʯͰ͢ 1. ಡΈ͍ͨ໨తͷίʔυʹؔ࿈͢Δૢ࡞Λߦ͏

  65. 2. ಡΈ͍ͨίʔυʹؔ࿈͢ΔϩάΛ୳͢ • ૢ࡞1ʹΑΓग़ྗ͞ΕͨLogcat͔ΒಡΈ͍ͨίʔυʹ 
 ؔ࿈͢ΔϩάΛ୳͢ • ஍ຯʹ໨grepྗ͕໰ΘΕΔ • ϩάग़ྗͷྔ͕ଟ͍ૢ࡞ͷ৔߹͸ϑΝΠϧʹॻ͖ग़্ͨ͠Ͱ

    ୳͢ํ͕͍͍
  66. • ؔ࿈ͦ͠͏ͳϩάൃݟ 2. ಡΈ͍ͨίʔυʹؔ࿈͢ΔϩάΛ୳͢

  67. UninstallerActivity(19960):Uninstallingextras=Bundle[{com.an droid.packageinstaller.extra.APP_LABEL=DroidKaigi2021,com. android.packageinstaller.applicationInfo=ApplicationInfo{5f5c cecio.github.droidkaigi.feeder.debug},android.intent.extra.UN INSTALL_ALL_USERS=false, com.android.packageinstaller.extra.UNINSTALL_ID=-2147483 643}] 
 I/ActivityManager( 1424):

    Force stopping io.github.droidkaigi.feeder.debug appid=10666 user=0: deletePackageX I/ActivityManager( 1424): Killing 23256:io.github.droidkaigi.feeder.debug/u0a666 (adj 940): stop io.github.droidkaigi.feeder.debug due to deletePackageX • ԫ৭෦෼͸ݻఆจࣈྻͬΆ͍ งғؾ • tagʢUninstallerActivityͷ ෦෼ʣ͸ݻఆจࣈྻͰίʔυ ্ʹఆٛ͞Ε͍ͯΔ͜ͱ͕ଟ ͍ͷͰݕࡧʹ࢖͍΍͍͢ 3. ݟ͚ͭͨϩά͔ΒݻఆจࣈྻΛ୳͢
  68. • ظ଴Ͳ͓Γ͍͍ײ͡ʹݕࡧ ʹҾ͔͔ͬΓ·ͨ͠ • ݕࡧʹώοτͨ͠ίʔυΛ ى఺ʹಡΈ͍ͨ໨తͷ 
 ίʔυΛ஍ಓʹ୳͢ 4. ݟ͚ͭͨจࣈྻΛACSͰݕࡧ͢Δ

  69. γεςϜ͕ग़ྗ͢ΔϩάͰ࢖͑ͦ͏ͳ΋ͷ • γεςϜαʔϏεͷίʔυΛಡΉͳΒdumpsysͷϩάΛ 
 ࢖͏ͷ͕͓͢͢Ί • ৭Μͳϩά͔Β୳͢ͳΒbugreportΛ࢖͏ͷ͕͓͢͢Ί • ಡΈ͍ͨίʔυʹΑͬͯ࢖͑Δϩά͸ଞʹ΋৭ʑ͋Δ

  70. ಡΈ͍ͨ໨తͷίʔυʹͨͲΓணٕ͘ज़ • Android Code SearchͷݕࡧΛ࢖͏ • LogcatͳͲγεςϜ͕ग़ྗ͢ΔϩάΛ࢖͏ • ΞϓϦ্ʹදࣔ͞ΕΔจࣈྻΛ࢖͏

  71. ΞϓϦ্ʹදࣔ͞ΕΔจࣈྻΛ࢖͏ 1. ಡΈ͍ͨ໨తͷίʔυʹؔ࿈͢ΔΞϓϦΛ୳͢ 2. ૢ࡞1Ͱݟ͚ͭͨΞϓϦͰಡΈ͍ͨίʔυʹ 
 ɹؔ࿈͢Δը໘Λ୳͢ 3. ݟ͚ͭͨը໘͔ΒݻఆจࣈྻΛ୳͢ 4.

    ݟ͚ͭͨจࣈྻΛAndroid Code Search(ACS)Ͱݕࡧ͢Δ
  72. • ʮΞϓϦ͕ڧ੍ఀࢭ͞ΕΔ࣌ʹߦΘΕΔ͜ͱʯ 
 ΛಡΈ͍ͨ໨తͷίʔυͱͯ͠ɺ۩ମతͳखॱΛઆ໌ • ࢿྉΛݟͳ͕ΒΈͳ͞ΜͷखݩͰ࣮ࡍʹ΍ͬͯΈΔ͜ͱΛ 
 ͓͢͢Ί͠·͢ ΞϓϦ্ʹදࣔ͞ΕΔจࣈྻΛ࢖͏

  73. • ʮΞϓϦ͕ڧ੍ఀࢭ͞ΕΔ࣌ʹߦΘΕΔ͜ͱʯ͕஌Γ͍ͨͷ ͰɺઃఆΞϓϦ͕ྑͦ͞͏ 1. ಡΈ͍ͨ໨తͷίʔυʹؔ࿈͢ΔΞϓϦΛ୳͢

  74. • ʮΞϓϦ͕ڧ੍ఀࢭ͞ΕΔ ࣌ʹߦΘΕΔ͜ͱʯ͕஌Γ ͍ͨͷͰɺઃఆΞϓϦͷ 
 ͜ͷը໘͕ྑͦ͞͏ 2. ಡΈ͍ͨίʔυʹؔ࿈͢Δը໘Λ୳͢

  75. • ʮڧ੍ఀࢭ͠·͔͢ʁʯ͸ ݻఆจࣈྻͬΆ͍ͷͰ 
 ݕࡧͷૉࡐʹ͠·͠ΐ͏ 3. ݟ͚ͭͨը໘͔ΒݻఆจࣈྻΛ୳͢

  76. • ݕࡧͯ͠ແࣄώοτ͠·ͨ͠ • ACS೔ຊޠͷݕࡧ΋໰୊ͳ͘ಈ͘ͷΑ͍ʂ 4. ݟ͚ͭͨจࣈྻΛACSͰݕࡧ͢Δ

  77. • ΞϓϦจݴ͸ݕࡧ͢Δͱߴ֬཰Ͱstrings.xml͕ώοτ͢Δ • ώοτͨ͠stringͷnameͰ͞Βʹݕࡧ͢Δ • nameͰݕࡧ͢Δͱදࣔͯ͠Δ࣮૷ʹͨͲΓண͘ • ͔ͦ͜ΒपลͷίʔυΛಡΜͰ͍͘ 4. ݟ͚ͭͨจࣈྻΛACSͰݕࡧ͢Δ

  78. • ͍͍ײ͡ʹݕࡧʹώοτͨ͠ • language:javaΛ͚ͭͯ stirngs.xml͕ݕࡧ݁Ռʹ 
 Ҿ͔͔ͬΒͳ͍Α͏ʹͯ͠Δ • ݕࡧʹώοτͨ͠ίʔυΛى఺ ʹಡΈ͍ͨ໨తͷ

    
 ίʔυΛ஍ಓʹ୳͢ 4. ݟ͚ͭͨจࣈྻΛACSͰݕࡧ͢Δ
  79. Android FrameworkͰ 
 ΞϓϦ։ൃऀ͕खܰʹ 
 ಡΊͦ͏ͳίʔυͷ঺հ

  80. frameworks/ • Android Framework Layerશൠͷίʔυ • https://cs.android.com/android/platform/ superproject/+/master:frameworks/

  81. frameworks/base/services/core/ • γεςϜαʔϏεͷίʔυ • https://cs.android.com/android/platform/ superproject/+/master:frameworks/base/services/ core/

  82. frameworks/base/core/java/ • Android SDKશൠͷίʔυ • https://cs.android.com/android/platform/ superproject/+/master:frameworks/base/core/java/

  83. packages/apps/ • γεςϜΞϓϦશൠͷίʔυ • https://cs.android.com/android/platform/ superproject/+/master:packages/apps/

  84. ΞϓϦ։ൃऀ͕खܰʹಡΊͦ͏ͳίʔυ • Android Framework Layer͸C/C++ͷίʔυ΋Ұ෦͋Γ ·͕͢ɺJavaͷίʔυ΋ΊͬͪΌ͋ΔͷͰಡΈ๞͖Δ͜ͱ ͸ͳ͍ͱࢥ͍·͢ʂ

  85. Code Readingͷ݁ՌΛ 
 ·ͱΊΔ

  86. Code Readingͷ݁ՌΛ·ͱΊΔ • ·ͱΊͨ݁Ռ͸͖ͬͱ୭͔ͷ໾ʹཱͪ·͢☺ • ·ͱΊ͓ͯ͘ͱࣗ෼͕ݟฦ࣌͢ʹศར👍 • ·ͱΊͯͲ͔͜ʹެ։͓ͯ͘͠ͷ͕͓͢͢ΊͰ͢✨

  87. Code Readingͷ݁ՌΛͲ͏·ͱΊΔ͔ • Code Readingͨ͠ର৅ͷ֓ཁΛهࡌ͢Δ • Code Readingͨ͠ཧ༝ͱΘ͔ͬͨ͜ͱͷཁ໿Λهࡌ͢Δ • ॏཁͳ࣮૷෦෼͸ίʔυ෇͖ͰϝϞΔ

    + ίʔυͷϦϯΫΛ͚ͭΔ • ࢀߟʹͳΔυΩϡϝϯτͷϦϯΫΛషΔ • Code Reading࠷தϝϞΛ࢒͠ɺͦΕ΋ͬ͟ͱهࡌ͢Δ
  88. Code Readingͷ݁ՌΛͲ͏·ͱΊΔ͔ • ͦΕͧΕͷ޻ఔʹ͍ͭͯɺࢲ͕ҎલCode Readingͯ͠ 
 ݁ՌΛ·ͱΊͨهࣄΛྫʹઆ໌͠·͢ • ·ͱΊΔࡍͷࢀߟʹͳΕ͹ͱ✨

  89. “Android11͔Βಋೖ͞ΕͨAuto-reset permissionsΛௐ΂ͯΈͯΘ͔ͬͨ͜ͱ” https://hack-it-iron.hatenablog.com/entry/ 2020/12/14/081217 Code Readingͷ݁ՌΛͲ͏·ͱΊΔ͔

  90. Code Readingͷ݁ՌΛͲ͏·ͱΊΔ͔ • Code Readingͨ͠ର৅ͷ֓ཁΛهࡌ͢Δ • Code Readingͨ͠ཧ༝ͱΘ͔ͬͨ͜ͱͷཁ໿Λهࡌ͢Δ • ॏཁͳ෦෼͸ίʔυͱίʔυ΁ͷϦϯΫΛهࡌ͢Δ

    • ࢀߟʹͳΔυΩϡϝϯτͷϦϯΫΛهࡌ͢Δ • Code Reading࠷தϝϞΛ࢒͠ɺͦΕ΋ͬ͟ͱهࡌ͢Δ
  91. • ର৅͕ಛఆͷػೳͰ͋Ε͹ 
 ͦͷػೳͷ֓ཁΛهࡌ͢Δ • ֓ཁ͕ॻ͍ͯ͋ΔͱCode Readingͨ݁͠Ռͷ·ͱΊ ΋ཧղ͠΍͘͢ͳΔ Code Readingͨ͠ର৅ͷ֓ཁΛهࡌ͢Δ

  92. Code Readingͷ݁ՌΛͲ͏·ͱΊΔ͔ • Code Readingͨ͠ର৅ͷ֓ཁΛهࡌ͢Δ • Code Readingͨ͠ཧ༝ͱΘ͔ͬͨ͜ͱͷཁ໿Λهࡌ͢Δ • ॏཁͳ෦෼͸ίʔυͱίʔυ΁ͷϦϯΫΛهࡌ͢Δ

    • ࢀߟʹͳΔυΩϡϝϯτͷϦϯΫΛهࡌ͢Δ • Code Reading࠷தϝϞΛ࢒͠ɺͦΕ΋ͬ͟ͱهࡌ͢Δ
  93. • ཧ༝Λॻ͘ͱ໨తʹ͋ͬͨ 
 ίʔυΛಡΉ͜ͱʹ 
 ूதͰ͖Δ • Θ͔ͬͨ͜ͱͷཁ໿Λ 
 ॻ͘ͱ·ͱΊΛಡΈฦ͢

    
 ࡍʹศར ཧ༝ͱΘ͔ͬͨ͜ͱͷཁ໿Λهࡌ͢Δ
  94. Code Readingͷ݁ՌΛͲ͏·ͱΊΔ͔ • Code Readingͨ͠ର৅ͷ֓ཁΛهࡌ͢Δ • Code Readingͨ͠ཧ༝ͱΘ͔ͬͨ͜ͱͷཁ໿Λهࡌ͢Δ • ॏཁͳ෦෼͸ίʔυͱίʔυ΁ͷϦϯΫΛهࡌ͢Δ

    • ࢀߟʹͳΔυΩϡϝϯτͷϦϯΫΛهࡌ͢Δ • Code Reading࠷தϝϞΛ࢒͠ɺͦΕ΋ͬ͟ͱهࡌ͢Δ
  95. • Code Readingͷ·ͱΊจ ষ͚ͩͰ఻͑Δͷ͸೉͍͠ • ࣮૷෦෼ͷίʔυ΋ަ͑ͯ ·ͱΊΔͷ͕͓͢͢Ί • ίʔυ΁ͷϦϯΫ΋Ұॹʹ ͋Δͱͳ͓Α͍👍

    ίʔυͱίʔυ΁ͷϦϯΫΛهࡌ͢Δ
  96. Code Readingͷ݁ՌΛͲ͏·ͱΊΔ͔ • Code Readingͨ͠ର৅ͷ֓ཁΛهࡌ͢Δ • Code Readingͨ͠ཧ༝ͱΘ͔ͬͨ͜ͱͷཁ໿Λهࡌ͢Δ • ॏཁͳ෦෼͸ίʔυͱίʔυ΁ͷϦϯΫΛهࡌ͢Δ

    • ࢀߟʹͳΔυΩϡϝϯτͷϦϯΫΛهࡌ͢Δ • Code Reading࠷தϝϞΛ࢒͠ɺͦΕ΋ͬ͟ͱهࡌ͢Δ
  97. • Code Reading͍ͯ͠Δத ͰࢀߟʹͳΓͦ͏ͳυΩϡ ϝϯτ͋Ε͹ɺඞཁͳͱ͜ ΖͰهࡌ͢Δ • ࢀߟϦϯΫूΈ͍ͨͳܗͰ ࠷ޙͷํʹ·ͱΊͯهࡌ 


    ͢Δͷ΋͋Γ ࢀߟʹͳΔυΩϡϝϯτͷϦϯΫΛهࡌ͢Δ
  98. Code Readingͷ݁ՌΛͲ͏·ͱΊΔ͔ • Code Readingͨ͠ର৅ͷ֓ཁΛهࡌ͢Δ • Code Readingͨ͠ཧ༝ͱΘ͔ͬͨ͜ͱͷཁ໿Λهࡌ͢Δ • ॏཁͳ෦෼͸ίʔυͱίʔυ΁ͷϦϯΫΛهࡌ͢Δ

    • ࢀߟʹͳΔυΩϡϝϯτͷϦϯΫΛهࡌ͢Δ • Code ReadingதϝϞΛ࢒͠ɺͦΕ΋ͬ͟ͱهࡌ͢Δ
  99. • Code Reading͢Δ্Ͱ 
 ϝϞ͸େࣄ • ͪΐͬͱͨ͠ϝϞͰ΋ফͣ͞ ʹ࢒͓ͯ͘͠ • ·ͱΊͷ࠷ޙͷํʹϝϞΛ

    
 ͦͷ··ࡶʹॻ͍͓͚ͯͩ͘ Ͱ΋Ձ஋͸͋Δ ϝϞΛ࢒͠ɺͦΕ΋ͬ͟ͱهࡌ͢Δ https://github.com/operando/JobScheduler-Code-Reading
  100. ·ͱΊ

  101. ·ͱΊ • Android Frameworkͷίʔυ͸ಡΉςΫχοΫΛ਎ʹ 
 ͚ͭΕ͹ɺΘΓͱ͢ΜͳΓಡΊΔΑ͏ʹͳΓ·͢💪 • ͨͩίʔυྔ͕๲େͳͷͰࠜؾڧ͞͸ඞཁͰ͢😅 • ಡΜͩΒ·ͱΊΛॻ͍ͯ஌ݟΛڞ༗͠·͠ΐ͏👍

  102. Thank you!

  103. ͜ΕҎ߱͸ొஃ࣌ؒͷ౎߹Ͱ ࡟ͬͨεϥΠυू ʢ͓·͚ʣ

  104. Android Framework Code Readingͷ 
 ώϯτʹͳΔॻ੶ • AndroidΛࢧ͑Δٕज़ʪⅠʫ,ʪⅡʫ • Androidͷͳ͔Έ

    InsideAndroid
  105. Android FrameworkͷίʔυΛμ΢ϯϩʔυ͢Δ • Repoͱ͍͏πʔϧΛ࢖͏͜ͱͰμ΢ϯϩʔυͰ͖Δ • Android OSΛ։ൃ͢Δ্Ͱ͸ඞਢͳπʔϧ • ৭ʑେมͳͷͰຊฤͰͷ঺հΛආ͚ͨ😂 •

    https://source.android.google.cn/setup/build/ downloading
  106. adb-peco • ෳ਺AndroidσόΠε͕PCʹ઀ଓ͞Ε͍ͯΔ࣌ʹ 
 σόΠεબ୒Λࢧԉͯ͘͠ΕΔπʔϧ • https://github.com/tomorrowkey/adb-peco

  107. AIDEGen • Android Frameworkͷ։ൃΛIDEͰߦ͏ͨΊʹ৭ʑ΍ͬͯ ͘ΕΔπʔϧͬΆ͍ • https://android.googlesource.com/platform/tools/ asuite/+/refs/heads/master/aidegen/README.md • ࢖ͬͨ͜ͱͳ͍͚ͲɺࢿྉΛ࡞ͬͯΔաఔͰݟ͚ͭͨ

  108. AIDEGen https://codechacha.com/ja/android-aidegen/ “AIDEGenʹIDEͰAndroid Framework։ൃ”

  109. Session Buddy • Chrome Extension • https://sessionbuddy.com/ • ։͍ͯΔλϒΛλϒɾ΢Οϯυ΢ͷঢ়ଶΛอଘͰ͖Δ •

    Code Readingͯ͠ΔͱΊͬͪΌλϒ։͖·͘Δ • ಡΜͰΔঢ়ଶΛҰ୴อଘ͓͖͍ͯͨ͠৔߹ʹศར
  110. πϦʔܕλϒ • Firefox Add-ons • https://addons.mozilla.org/ja/ fi refox/addon/tree- style-tab/ •

    ಡΜͰ͍Δίʔυͷϝιουݺͼग़͠ͷ֊૚ͱ͔ΛπϦʔ ܕͷλϒͰ؅ཧ͢Δͷʹศར
  111. ͪΐͬͱੲ࿩ͱײँͷؾ࣋ͪ • ACS͕ެ։͞ΕΔલ͸༗ࢤʹΑΔӡӦͰɺOpenGrokͱ͍ ͏ιϑτ΢ΣΞΛ࢖ͬͯࣅͨ΋ͷ͕ߏங͞Ε͍ͯͨ • https://sites.google.com/site/devcollaboration/ codesearch • ͱͯ΋͓ੈ࿩ʹͳΓ·ͨ͠🙏͘͢͝ײँ͍ͯ͠·͢ʂ

  112. ·ͬͨΓAndroid Framework Code Reading • AndroidͷιʔείʔυΛಡΜͰɺ։ൃ౳ʹ໾ཱͯΔษڧձΛ 
 ਺೥લ ࢲ͕ओ࠵ऀͰ΍͍ͬͯͨ •

    ࢀՃऀͷΈͳ͞Μ͕ಡΜͩίʔυΛ·ͱΊͨͷ͕GitHubʹ·ͱ·ͬͯΔ • Կ͔ͷࢀߟʹͳΕ͹ͱʂ • https://github.com/AndroidFrameworkCodeReading/ CodeReadingHistory