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

I/O '19 Extended in Korea Android ~ What's New in Android

I/O '19 Extended in Korea Android ~ What's New in Android

I/O '19 Extended in Korea Android 에서 발표한 자료입니다.

pluulove (노현석)

June 15, 2019
Tweet

More Decks by pluulove (노현석)

Other Decks in Technology

Transcript

  1. DarkTheme Gesture Navigation Kotlin Jetpack Compose External Storage ViewBindings Location

    Connectivity SeJings Panel Bubbles External Storage 5th session Live Caption Suggested actions in notiTcations Privacy Accessibility Project Mainline Foldables G networks Digital wellbeing Focus Mode Family Link Audio playback capture New audio and vid n 1.1 and ANGLE al Networks API 1.2 ART optimiza Therma Kotlin 2nd session Privacy 4th session Accessibility 3rd session Background Activity
  2. • ݽٚ জ ਤী ಴द • RAM, ੹ਗ, ࢿמী ؀ೠ

    ੉ग • बпೠ ࠁউ Ҋ۰ ࢎ೦ਵ۽ ࠙ܨ • Deprecated SWAs • Android Goীࢲ SAWs Permission ӂೠਸ ࠗৈೞ૑ ঋ਺ System AleX Window Se2ings.canDrawOverlays() == false
  3. • SAW੄ ؀উ଼ • NotiCcation ഐ୹ী ੄೧ ֢୹ • ઺ਃೠ

    ੘সਸ औѱ ੽Ӕೞח ߑߨ • ই੉௑җ Activityܳ ੐߬٣٘ೞח ഋక • ࢸ੿ > জ ߂ ঌܿ > ঌܿ > ঌܿ ೂࢶ (Q Beta4) Bubbles
  4. • Collapsed • ই੉௑җ ݫࣁ૑ ֢୹ • Expanded • ಟ୛૓࢚క۽,

    Window ղࠗ۽ Activity ֢୹ Bubbles Q Beta4ীࢲ ز੘ ࢚੉ ޙઁ (IssueTracker) • NotiCcationਵ۽ Bubble ޷֢୹ • ࠂࣻ Bubble ֢୹
  5. extended 2. BubbleMetadata ࢤࢿ val target = Intent(context, BubbleActivity::class.java) val

    bubbleIntent = PendingIntent.getActivity(context, 0, target, 0) // Create bubble metadata val bubbleData = NotiCcation.BubbleMetadata.Builder() .setDesiredHeight(600) .setIcon(Icon.createWithResource(context, R.drawable.icon)) .setIntent(bubbleIntent) .build()
  6. extended 3. Add BubbleMetadata to NotiTcation val builder = NotiCcation.Builder(context,

    CHANNEL_ID) .setContentIntent(contentIntent) .setSmallIcon(smallIcon) .setBubbleMetadata(bubbleData)
  7. extended Modes DAYNIGHT MODE_NIGHT_YES ೦࢚ Dark Theme MODE_NIGHT_NO ೦࢚ Light

    Theme MODE_NIGHT_FOLLOW_SYSTEM दझమ ࢸ੿ী ٮܲ Theme MODE_NIGHT_AUTO_BATTERY ߓఠܻ ੺੹ ݽ٘ੌ ٸ Dark Theme Add, AppCompat 1.1.0
  8. extended ࢎਊ੗о Dark Theme ࢎਊೡ ࣻ ੓ח ߑߨਸ ઁҕ Options

    • Light • Dark • ੺੹ ݽ٘ Android P ੉ೞ
  9. extended • दрҗ ҙ۲ػ MODE_NIGHT_AUTO_TIME deprecated • Dark Themeܳ On/Oc

    оמೠ ӝמ ഋక • WebView + Force Dark ૑ਗ • Custom Tab ١ ૑ਗ ৘੿ • NotiCcation਷ ੗ز ੸ਊ / ழझథ਷ ࣻ੿ ೙ਃ Dark theme in Q
  10. extended Dark-theming your app Option A Theme.AppCompat.DayNight // ੉޷ ࢎਊ

    ઺ ࣻب ੓׮ Theme.DeviceDefault.DayNight // ٣߄੉झ ࢸ੿ী ٮۄ ThemeOverlay.DeviceDefault.Accent.DayNight Option B android.forceDarkallowed=“true” // AndroidManifest.xml ী ࢸ੿ view.setForceDarkallowed(false); // ForceDarkܳ ઁ৻୊ܻ
  11. extended Dark-theming your app Option C Night Modeী ҙ۲ػ -night

    ܻࣗझ ೠ੿੗৬ ࢸ੿ਵ۽ ੘স Option D OS੄ Night Modeܳ ޖद
  12. • ӝࠄ੸ੋ ই੉٣যח दझమ UI ৔৉ਸ ઴੉ח Ѫ • ށੑഋ(Immersive)

    ੹୓ ചݶীࢲח 
 ઁझ୊۽ ׮ܲ ز੘ਸ ࢎਊ • OEMҗ ഈ۱ೞৈ ױࣽೠ ಴ળਸ ٜ݅ ৘੿ • ࢸ੿ > दझమ > ز੘ > System navigation
 (Q Beta4) Gesture Navigation
  13. • System gestureо о૑ח ৔৉ • ઝ਋ஏ : Back Gesture

    • ೞױ : Home Gesture System gesture INSETS New in Q
  14. • জ੉ ੤੿੄ೡ ࣻ হח ৔৉ • Qীࢲח Home Gesture

    ਊب۽ ࢎਊ Mandatory System gesture INSETS New in Q
  15. • Hyphenationо API 23ীࢲ بੑ • Android Qীࢲח Ocо ӝࠄ

    Text Hyphenation On Hyphenation Od 0 1.25 2.5 3.75 5 Text Measure in ms
  16. #include <android/system_fonts.h> ASystemFontIterator* iterator = ASystemFontIterator_open(); ASystemFont* font = nullptr;

    while ((font = ASystemFontIterator_next(iterator)) != nullptr) { const char* path = ASystemFont_getFontFilePath(font); // ... ASystemFont_close(font); } ASystemFontIterator_close(iterator); Native API for system fonts
  17. Pevormance Optimize Debugging suppot API Annotation KTX Coroutines Suppot Jetpack

    Compose Kotlin plugin for Android Studio Refactoring/Lint Suppot Kotlin Trst
  18. • Kotlinਸ ݢ੷ ੽Ӕೞח Ѫ਷ ਤ೷ • Java ঱যח ই૒

    ૑ਗ • Java৬ ࢚ഐ ഐജ ୓௼ • Project৬ Team੄ ࢚ടਸ ୓௼ • ౟ۨ੉٘ য়೐ • ࢤ࢑۱, पઁ ݅઒, ۞׬ழ࠳, ࠽٘ ࣘب, APK ௼ӝ Kotlin Trst: should I switch?
  19. Java Kotlin Plahorm SDK SuppoX Yes Yes Android Studio SuppoX

    Yes Yes Lint Yes Yes Guided docs SuppoX Yes Yes API docs SuppoX Yes Yes AndoridX SuppoX Yes Yes AndroidX Kotlin-speciTc APIs (e.g. KTX, coroutines) N/A Yes Online training Best ecot Yes Samples Best ecot Yes Multi-plahorm Project No Yes Jetpack Compose No Yes What’s does Kotlin First mean?
  20. • Android Qীࢲ APIח Nullable Annotation ૑ਗ • Qীࢲח Null

    ೲਊਸ য়ܨ۽ ъઁച • Kotlin 1.3.30ীࢲ
 kapt੄ Incremental annotation processing Kotlin 2nd Kotlin Under the Hood
  21. • OS ৔৉੄ ਋ࢶ ࣽਤ • Prioritized (਋ࢶࣽਤ ૑੿ؽ) •

    Gentle (ઑਊ൤ ಴दؽ) • Prioritized • ೙ࣻ ੢஖ ӝמ • ழޭפா੉࣌ • ੉߮౟/ঌۈ • ࢎਊ੗ী ੄೧ Proritized/Gentle ੹ജ оמ Interruptions
  22. History of Android 2008 2009 2010 2011 2012 2013 2014

    2015 2016 2017 2018 1.0 Android Studio ART Recycler View Constraint
 Layout Kotlin Arch Components
  23. • ରࣁ؀ UI toolkit • Unbundled • ߈਽ഋ • Kotlinਵ۽

    ੘ࢿ • React, Litho, View.js, Flu2er • Open Source Jetpack Compose
  24. • Jetpack UI Widget • Not View, Not Fragment =>

    ؊ ੘਷ ݽٕ • Kotlin Compiler Plugin ࢎਊ • ӝઓ App/Code৬ ഐജ • Experimental What is Compose?
  25. extended @Composable fun Greeting(name: String) { Text("Hello $name") } Hello

    Jetpack Hello Kotlin Hello Google Hello Android Hello World
  26. • Annotation Processorܳ ޷ࢎਊ, Kotlin Compiler Plugin ࢎਊ • ೣࣻ੄

    ݽٚ ݒѐ ߸ࣻח ҳࢿ ਃࣗ੄ ݒѐ ߸ࣻ ژח ࣘࢿ • XML ۨ੉ইਓ হ਺ • ؘ੉ఠ ߄ੋ٬ হ਺ @Composable
  27. extended BackpoX @Composable @GenerateView fun Greeting(name: String) { /* ...

    */ } <GreetingView android:id="@+id/greeting" app:name="@string/greeting_name" /> val greeting: GreetingView = CndViewById("R.id.greeting") greeting.setName("Android")
  28. • CndViewById()੉ ࠛ೙ਃ • ஹ౵ੌ दী XML੄ ߄ੋ٬ ௏٘ ࢤࢿ

    • DataBindingҗ ਬࢎೠ ഋక • Null-safe / Type-safe ViewBindings
  29. extended <androidx.constraintlayout.widget.ConstraintLayout> <TextView android:id="@+id/package_name" /> <TextView android:id="@+id/class_name" /> <ImageBu2on android:id="@+id/more_options"

    /> </androidx.constraintlayout.widget.ConstraintLayout> @Override fun onCreate(savedInstanceState: Bundle) { super.onCreate(savedInstanceState) binding = SearchItemBinding.inÄate(layoutInÄater) setContentView(binding.rootView) } fun later() { binding.packageName.text = "android" } search_item.xml
  30. extended <androidx.constraintlayout.widget.ConstraintLayout> <TextView android:id="@+id/package_name" /> <TextView android:id="@+id/class_name" /> <ImageBu2on android:id="@+id/more_options"

    /> </androidx.constraintlayout.widget.ConstraintLayout> @Override fun onCreate(savedInstanceState: Bundle) { super.onCreate(savedInstanceState) binding = SearchItemBinding.inÄate(layoutInÄater) setContentView(binding.rootView) } fun later() { binding.packageName.text = "android" } search_item.xml
  31. extended search_item.xml <androidx.constraintlayout.widget.ConstraintLayout> <TextView android:id="@+id/package_name" /> <TextView android:id="@+id/class_name" /> <ImageBu2on

    android:id="@+id/more_options" /> </androidx.constraintlayout.widget.ConstraintLayout> @Override fun onCreate(savedInstanceState: Bundle) { super.onCreate(savedInstanceState) binding = SearchItemBinding.inÄate(layoutInÄater) setContentView(binding.rootView) } fun later() { binding.packageName.text = "android" }
  32. Common storage Downloads Only accessible via system picker Photo/Video Gated

    behind storage permission Audio Gated behind storage permission Internal app storage Only accessible to app Scoped Storage Internal Storageח ӝࠄ ࠺ҕѐ, ׮ܲ জ਷ ੽Ӕ ࠛо External Storage ੽Ӕਸ ਤ೧ࢲ
 READ/ WRITE_EXTERNAL_STORAGE ӂ ೠ ೙ਃ MediaStore Queryܳ ా೧ /sdcard ইې ੄ ޷٣যܳ Ѩ࢝ оמ
  33. targetSdk = P : ߸ز হ਺ targetSdk = Q ੉࢚

    / opt-in • Sandbox : ೧׼ জীࢲ݅ ੽Ӕ оמ • Media Cles: MediaStore API৬ Storage Permission ೙ਃ • Photo Metadata : Storage/MediaLocation Permission ೙ਃ • MediaStore੄ ਤب/҃بח Qীࢲ deprecated, ExifIntevace ୶ୌ • ݽٚ ౵ੌ : AndroidManifestী ࢸ੿ ೙ਃ Scoped Storage 5th What’s New in Shared Storage
  34. Android R Scoped Storage will be 
 required in next

    year’s 
 major plaÅorm release for all apps, independent of target SDK level, so we recommend you add suppot to your app well in advance.
  35. ࢎਊ੗ ೐ۄ੉ߡद ъച, ࢿמ ੷ೞܳ ࠁ৮ • ೦࢚ ೲਊ /

    জ ࢎਊ ઺ / Ѣࠗ Permission ୶о • ACCESS_FINE_LOCATION / ACCESS_COARSE_LOCATION / ACCESS_BACKGROUND_LOCATION Location
  36. extended AndroidManifest.xml targetSdk : P ੉ೞ <manifest> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    </manifest> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> Auto Include
  37. ٣߄੉झܳ Q সӒۨ੉٘ द ӂೠ ߸҃ Target 
 SDK Coarse

    or Cne permission granted? Background permission deCned in manifest? Updated default 
 permission state Q Yes Yes Foreground and background access Q Yes No Foreground access only Q No (Ignored by system) No access 9 ੉ೞ Yes Automatically added by the system at device upgrade time Foreground and background access 9 ੉ೞ No (Ignored by system) No access
  38. Location best practices • ೙ਃೠ ӂೠ݅ ਃ୒ • Foreground ݅

    ਤ஖о ೙ਃೠ ҃਋ ACCESS_BACKGROUND_LOCATION ח ࢤۚ • ForegroundServiceীࢲ ೡ ҃਋ “location” ServiceType ੉ਊ • TargetSdkо Q޷݅ੋ ҃਋, 
 ACCESS_BACKGROUND_LOCATION੉ ੗زਵ۽ ୶о
  39. • Backgroundীࢲ statActivity() ઁೠ • Activity द੘ ઑѤ • Foreground

    জ • System, Broadcastীࢲ PendingIntent ࢎਊ • Foreground NotiCcation ࢎਊ • Android Qীࢲ प೯غח ݽٚ জী ੸ਊ Background Activity staXs 4th Privacy Change in Android Q
  40. extended val fullScreenIntent = Intent(this, CallActivity::class.java) val fullScreenPendingIntent = PendingIntent.getActivity(this,

    0, fullScreenIntent, PendingIntent.FLAG_UPDATE_CURRENT) val notiCcationBuilder = NotiCcationCompat.Builder(this, CHANNEL_ID) .setSmallIcon(R.drawable.notiCcation_icon) .setContentTitle("Incoming call") .setContentText("(919) 555-1234") .setPriority(NotiCcationCompat.PRIORITY_HIGH) .setCategory(NotiCcationCompat.CATEGORY_CALL) .setFullScreenIntent(fullScreenPendingIntent, true) val incomingCallNotiCcation = notiCcationBuilder.build()
  41. • ঌۈ, ੹ച৬ э਷ ӟәೠ ࢎਊ੗ ߈਽ ਃҳ • FullScreenIntent

    • Foreground Service + NotiCcation Need to user's attention urgently
  42. • ࢸ੿ ߸҃ਸ ೡ ࣻ ੓ח ചݶ ઁҕ • ੋఠ֔

    োѾ, WiFi, NFC, Volume • AndroidX۽ ઁҕ ৘੿ • Android 9 (API 23) ੉ೞীࢲח ੸੺ೠ ചݶ੉ য়೑ SeJings Panel val panelIntent = Intent(Se2ings.Panel.se2ings_panel_type) statActivityForResult(panelIntent)
  43. ACTION_INTERNET_CONNECTIVITY ࠺೯ӝ ݽ٘, Wi-Fi, ݽ߄ੌ ؘ੉ఠ ࠺೯ӝ ݽ٘, Wi-Fi, ݽ߄ੌ

    ؘ੉ఠ ACTION_WIFI Only Wi-Fi ACTION_NFC NFC ҙ۲ ࢸ੿ ACTION_VOLUME ࠅܬ ҙ۲ ࢸ੿ seJings_panel_type
  44. MAC address randomization Unbundle package installer Updatable privacy policies and

    handle Ad library dependency Camera metadat Foreground Service APIs for use cases Limit background activity launches C Unbundle Restrict Screen Reading Call screening Restrictions on phone, Call logs and Device identifier lockdown Location remind Remove contacts affinity Indicate location usage in the status bar TLSv3 ermissions for OEMs and carriers Strongly typed storage Hide USB serial number until app has permission Restrict access SMS receiver verification A Shadow call stack - Kernel and user space Scudo hardened Execute-only memory Security key me permissions for all apps Opportunistic location access nted Location gency Location sharing with other apps ess cricPrompt Consent for Device Admin efactor accessibility service capabilities rivacy-sensitive WiFi scanning Restrict app icon hiding Increased protection for Serial Number access ion Media Stack is updatable Conscrypt is updatable WPA3 Adiantum Key replacement for ne Encryption for entry-level devices
  45. • Update non-SDK inteuace restrictions • Permissions changes for fullscreen

    intents • Privacy (Scope storage, Location, Background activity, Hardware identiCers) • android.preference ۄ੉࠳۞ܻ ૑ਗ ઺ױ • Suppot for foldables • CameraX, ViewPager2 • etc.. etc… Android Q Checklist
  46. What’s New in Android What's New in the Android OS

    User Inteuace Dark Theme & Gesture Navigation Recommend Overview of Privacy Changes in Android Q ѐߊ੗ܳ ਤೠ উ٘۽੉٘ Q ੿ܻ by নଲࢳ