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

IO/Extended Yangon 2022 - What's new in Android?

IO/Extended Yangon 2022 - What's new in Android?

Aung Kyaw Paing

May 21, 2022
Tweet

More Decks by Aung Kyaw Paing

Other Decks in Technology

Transcript

  1. Aung Kyaw Paing
    What’s new in
    Android?
    Android 13, AS Electric Eel,
    Privacy Sandbox and much
    more

    View full-size slide

  2. Tiramisu
    Android 13

    View full-size slide

  3. User now has a choice to make app icons inherit the theme color
    Themed App Icons

    View full-size slide

  4. Developer has to provide a
    monochromatic app icons.
    Themed App Icons

    View full-size slide

  5. Built in photo pickers in OS. Using this picker doesn’t require
    READ_STORAGE permission.
    Photo Picker

    View full-size slide

  6. photo_picker.kt
    //If version > 13
    val intent = Intent(MediaStore.ACTION_PICK_IMAGES)
    //Setup picker config
    //Launch Picker
    startActivityForResult(intent, PHOTO_PICKER_REQUEST_CODE)

    View full-size slide

  7. photo_picker.kt
    //If version > 13
    val intent = Intent(MediaStore.ACTION_PICK_IMAGES)
    //Setup max count
    int maxCount = 5;
    intent.putExtra(MediaStore.EXTRA_PICK_IMAGES_MAX, maxCount)
    //Launch Picker
    startActivityForResult(intent, PHOTO_PICKER_REQUEST_CODE)

    View full-size slide

  8. photo_picker.kt
    //If version > 13
    val intent = Intent(MediaStore.ACTION_PICK_IMAGES)
    //Setup max count
    int maxCount = 5;
    intent.putExtra(MediaStore.EXTRA_PICK_IMAGES_MAX, maxCount)
    //Set to video only
    intent.type = "video/*"
    //Launch Picker
    startActivityForResult(intent, PHOTO_PICKER_REQUEST_CODE)

    View full-size slide

  9. photo_picker.kt
    override fun onActivityResult(...) {
    //if result ok
    when (requestCode) {
    REQUEST_PHOTO_PICKER_SINGLE_SELECT -> {
    val currentUri: Uri = data.data
    // Do stuff with the photo/video URI.
    }
    REQUEST_PHOTO_PICKER_MULTI_SELECT -> {
    // Get photo picker response for multi select.
    data.clipData.forEach { clipData ->
    val uri = clipData.uri
    // Do stuff with the photo/video URI.
    }
    }
    }
    }

    View full-size slide

  10. photo_picker.kt
    override fun onActivityResult(...) {
    //if result ok
    when (requestCode) {
    REQUEST_PHOTO_PICKER_SINGLE_SELECT -> {
    val currentUri: Uri = data.data
    // Do stuff with the photo/video URI.
    }
    REQUEST_PHOTO_PICKER_MULTI_SELECT -> {
    // Get photo picker response for multi select.
    data.clipData.forEach { clipData ->
    val uri = clipData.uri
    // Do stuff with the photo/video URI.
    }
    }
    }
    }

    View full-size slide

  11. photo_picker.kt
    override fun onActivityResult(...) {
    //if result ok
    when (requestCode) {
    REQUEST_PHOTO_PICKER_SINGLE_SELECT -> {
    val currentUri: Uri = data.data
    // Do stuff with the photo/video URI.
    }
    REQUEST_PHOTO_PICKER_MULTI_SELECT -> {
    // Get photo picker response for multi select.
    data.clipData.forEach { clipData ->
    val uri = clipData.uri
    // Do stuff with the photo/video URI.
    }
    }
    }
    }

    View full-size slide

  12. User can select a different language for different apps and won’t
    always be tied to system language.
    App-specific locale

    View full-size slide

  13. language_pref.kt
    val localeList = AppCompatDelegate.getApplicationLocales()
    //Show custom picker with locale list
    //Set selected locale
    val appLocale: LocaleListCompat = LocaleListCompat.forLanguageTags("xx-YY")
    AppCompatDelegate.setApplicationLocales(appLocale)

    View full-size slide

  14. Notification will be opted-out by default. Apps need to request
    permission to send notification
    Notification Permission

    View full-size slide

  15. Notification Permission

    View full-size slide

  16. On newly installed app
    If the app targets Android 13
    - MUST ask permission explicitly
    If the apps targets Android 12 and lower
    - System will ask permission when first notification channel is
    created.
    Notification Permission

    View full-size slide

  17. On existing app
    A temporary grant is given if user has enabled notification before
    and has existing notification channel.
    If the app targets Android 13
    - The grant lasts until user launches the app
    If the apps targets Android 12 and lower
    - The grant lasts until user select an option from permission
    prompt
    Notification Permission

    View full-size slide

  18. User can see all foreground services running under active app list
    in notification drawer
    Foreground Service
    Manager

    View full-size slide

  19. Foreground Service Manager
    Getting killed by FGS Manager does not kill your
    scheduled jobs and alarms.
    The system will alert user to interact with your
    active task if it runs for more than 20 hours in a
    day.

    View full-size slide

  20. Other changes
    “Restricted” bucket changes
    “NEARBY_WIFI_DEVICE” permission added
    Body sensor background permission added
    Quick Settings placement API
    Revoke permission API
    BLE Audio support
    MIDI 2.0
    Color vector fonts

    View full-size slide

  21. A new privacy standard
    Privacy Sandbox

    View full-size slide

  22. A new privacy standard that allow users info to be
    private. Currently in design proposal stage
    Privacy Sandbox

    View full-size slide

  23. Benchmark, Media3, Room, WorkManager
    Jetpack

    View full-size slide

  24. Kotlin Symbol Processor (Support)
    Rewritten in Kotlin
    Paging3 Support
    Room 2.5

    View full-size slide

  25. room_multimap.kt
    @Query("SELECT * FROM Artist
    JOIN Song ON Artist.artistName =
    Song.songArtistName")
    fun getArtistToSongs(): Map>

    View full-size slide

  26. Support for Rx And Guava
    Improve handling of invalid/valid state
    More callbacks
    Paging

    View full-size slide

  27. Jetpack compose support
    Multiple backstack support
    Two-pane layouts support for large screens
    Rewritten in Kotlin
    Navigation

    View full-size slide

  28. Stable release. Library to persist preferences locally
    DataStore

    View full-size slide

  29. Track and analyze performance problems in your UI.
    Support up to API Level 16.
    JankStats

    View full-size slide

  30. Create profiles for your app that populate ahead of time
    compilation traces to reduce startup time and janks.
    Baseline Profile

    View full-size slide

  31. Measures app startup and scrolling performance, locally
    and in CI.
    Macrobenchmark

    View full-size slide

  32. Write trace events to system trace buffer
    Tracing

    View full-size slide

  33. Supports new multiple form factors and multi-window
    devices.
    WindowManger

    View full-size slide

  34. Accepts drag and drop data easily
    DragAndDrop

    View full-size slide

  35. Emoji2 supports for latest emoji
    App-specific locale support from Android 13
    Play Splits to download additional locale
    AppCompat

    View full-size slide

  36. ExoPlayer3
    Media3
    Others

    View full-size slide

  37. Now with easier multi factor support!
    Jetpack Compose

    View full-size slide

  38. Font Padding
    Text Magnifier
    Downloadable fonts
    Text Improvements

    View full-size slide

  39. font_padding.kt
    Text(
    text = myText,
    style = TextStyle(
    lineHeight = 2.5.em,
    platformStyle = PlatformTextStyle(
    includeFontPadding = false
    ),
    lineHeightStyle = LineHeightStyle(
    alignment = Alignment.Center,
    trim = Trim.None
    )
    )
    )
    Set to true (left) and false (right)

    View full-size slide

  40. Text Magnifier

    View full-size slide

  41. downloadable_font.kt
    @OptIn(ExperimentalTextApi::class)
    val provider = GoogleFont.Provider(
    providerAuthority = "com.google.android.gms.fonts",
    providerPackage = "com.google.android.gms",
    certificates = R.array.com_google_android_gms_fonts_certs
    )
    val fontName = GoogleFont(“Lobster Two”)
    val fontFamily = FontFamily(
    Font(googleFont = GoogleFont(name), fontProvider = provider)
    )

    View full-size slide

  42. downloadable_font.kt
    @OptIn(ExperimentalTextApi::class)
    val provider = GoogleFont.Provider(
    providerAuthority = "com.google.android.gms.fonts",
    providerPackage = "com.google.android.gms",
    certificates = R.array.com_google_android_gms_fonts_certs
    )
    val fontName = GoogleFont(“Lobster Two”)
    val fontFamily = FontFamily(
    Font(googleFont = GoogleFont(name), fontProvider = provider)
    )

    View full-size slide

  43. downloadable_font.kt
    val fontFamily = FontFamily(
    Font(googleFont = GoogleFont(name), fontProvider = provider,
    weight = weight = FontWeight.Bold, style = FontStyle.Italic)
    )

    View full-size slide

  44. Lazy Grids
    Window Insets
    Window sizes
    Support for Wear OS
    Layout Improvements

    View full-size slide

  45. Tooling improvements

    View full-size slide

  46. Animation Preview

    View full-size slide

  47. Multipreview

    View full-size slide

  48. Recomposition count

    View full-size slide

  49. A new code sample repo that showcase Modern Android
    Development
    See: https://github.com/android/nowinandroid

    View full-size slide

  50. A brand new API for health data
    Health Connect API

    View full-size slide

  51. Centralized permissions, data management and storage for users and
    developers.
    Health Connect

    View full-size slide

  52. write_data.kt
    suspend fun insertSteps(healthConnectClient: HealthConnectClient) {
    val records = listOf(
    Steps(
    count = 120,
    startTime = START_TIME,
    endTime = END_TIME,
    startZoneOffset = START_ZONE_OFFSET,
    endZoneOffset = END_ZONE_OFFSET,
    )
    )
    val response = healthConnectClient.insertRecords(records)
    }

    View full-size slide

  53. read_data.kt
    suspend fun readDataRange(client: HealthConnectClient) {
    val response =
    client.readRecords(
    ReadRecordsRequest(
    recordType = Steps::class,
    timeRangeFilter = TimeRangeFilter.between(START_TIME, END_TIME),
    )
    )
    response.records.forEach {
    // Process each entry
    }
    }

    View full-size slide

  54. Electric Eel is here to shock you
    Android Studio

    View full-size slide

  55. View data from Google Play SDK index and provides lint checks if a SDK is
    outdated.
    SDK Insight

    View full-size slide

  56. Highlight codes that have relevant crash data. See stack traces, statistic, and link
    out to Crashlytics dashboard easily.
    Crashlytics

    View full-size slide

  57. New Logcat will be enabled by default
    New Logcat

    View full-size slide

  58. Add ability to resize emulator and supports for bluetooth emulation.
    Emulator

    View full-size slide

  59. You can now mirror connected devices and control from IDE.
    Device mirror

    View full-size slide

  60. SDK Index, Data Safety
    Play Store

    View full-size slide

  61. Data Safety
    Provides information for users on what data you collect and
    why. Full rollout by July.

    View full-size slide

  62. SDK Index
    Provides usage data, insights and data safety informations
    easily.

    View full-size slide

  63. LiveOps Beta
    Display your limited offers, events, updates, announcements on
    Play Store to have more reach.

    View full-size slide

  64. Integrity API
    Protects your app from potential fraudulent actions

    View full-size slide

  65. Others
    Signing Key Rotation Support
    More flexibility in subscriptions
    Ultra low price points
    Target API requirements

    View full-size slide

  66. Q&A
    P.S We are hiring.
    Email me at [email protected]

    View full-size slide