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 Slide

  2. Tiramisu
    Android 13

    View Slide

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

    View Slide

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

    View Slide

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

    View 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 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 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 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 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 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 Slide

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

    View 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 Slide

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

    View Slide

  15. Notification Permission

    View 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 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 Slide

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

    View 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 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 Slide

  21. A new privacy standard
    Privacy Sandbox

    View Slide

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

    View Slide

  23. Benchmark, Media3, Room, WorkManager
    Jetpack

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  28. Stable release. Library to persist preferences locally
    DataStore

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  32. Write trace events to system trace buffer
    Tracing

    View Slide

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

    View Slide

  34. Accepts drag and drop data easily
    DragAndDrop

    View Slide

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

    View Slide

  36. ExoPlayer3
    Media3
    Others

    View Slide

  37. Now with easier multi factor support!
    Jetpack Compose

    View Slide

  38. Font Padding
    Text Magnifier
    Downloadable fonts
    Text Improvements

    View 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 Slide

  40. Text Magnifier

    View 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 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 Slide

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

    View Slide

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

    View Slide

  45. Tooling improvements

    View Slide

  46. Animation Preview

    View Slide

  47. Multipreview

    View Slide

  48. Recomposition count

    View Slide

  49. Live Edit

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  53. 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 Slide

  54. 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 Slide

  55. Electric Eel is here to shock you
    Android Studio

    View Slide

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

    View Slide

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

    View Slide

  58. New Logcat will be enabled by default
    New Logcat

    View Slide

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

    View Slide

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

    View Slide

  61. SDK Index, Data Safety
    Play Store

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  65. Integrity API
    Protects your app from potential fraudulent actions

    View Slide

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

    View Slide

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

    View Slide