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

What's New in Android 11 - GDG Lahore

What's New in Android 11 - GDG Lahore

🔊 Wajahat Karim talks about the new features and APIs in Android 11 at Android 11 Meetups organized by GDG Lahore.

👉 Full video: https://youtu.be/mE-B2h5l2ac

Wajahat Karim

July 04, 2020
Tweet

More Decks by Wajahat Karim

Other Decks in Technology

Transcript

  1. GDG Lahore
    What’s new in Android
    Wajahat Karim
    Google Developer Expert in Android
    wajahatkarim.com

    View full-size slide

  2. GDG Lahore
    This is Wajahat Karim!
    - Google Developer Expert in Android
    - Over 8 years experience in Android
    - Open Source Contributor
    - Technical Blogs & Books Writer
    - Love to share my knowledge with others
    Follow me on Twitter @WajahatKarim
    Visit my website: wajahatkarim.com

    View full-size slide

  3. GDG Lahore
    So… what is new?
    What’s new about What’s New in Android?
    People
    Controls
    Privacy

    View full-size slide

  4. GDG Lahore
    People

    View full-size slide

  5. GDG Lahore
    Credits: OneSignal
    Conversations
    ● Dedicated section at top of the notifications
    ○ Only for chat / messaging apps

    View full-size slide

  6. GDG Lahore
    Credits: InfoTechNews
    Chat Bubbles
    ● Help users to keep conversations in view and
    accessible while multitasking
    ○ Only for chat / messaging apps
    ○ Created with Notifications API
    ○ Better than SYSTEM_ALERT_WINDOW
    permission
    https://wajahatkarim.com/2020/04/what-happened-to-chat-bubbles/

    View full-size slide

  7. GDG Lahore
    Credits: Android Central
    Autofill Keyboard
    ● Lets Autofill apps and Input Method Editors
    (IMEs) like Keyboards securely offer
    context-specific entities and strings directly
    in an IME’s suggestion strip.

    View full-size slide

  8. GDG Lahore
    Controls

    View full-size slide

  9. GDG Lahore
    Credits: CNET
    Quick Controls
    ● Triggers on long press Power button
    ○ Power off options
    ○ Google Play cards
    ○ Smart Home device controls

    View full-size slide

  10. GDG Lahore
    Credits: 9to5google
    Media Resumptions
    ● Control panel-esque setup embedded directly
    at the top of your screen
    ○ Used to be clustered between notifications
    ○ Only accessible through Developer
    Options for now

    View full-size slide

  11. GDG Lahore
    Credits: MashTips
    Share Menu
    ● Pin Apps in Share Menu
    ○ Allows faster sharing

    View full-size slide

  12. GDG Lahore
    ● Scheduling dark mode
    ○ All time dark or light
    ○ Switch between dark / light at specific
    times
    Credits: MashTips
    Improved Dark Mode

    View full-size slide

  13. GDG Lahore
    ● Picture-in-Picture displays can be resized
    ○ Such as Google Maps navigation
    ○ YouTube videos
    ○ Video Calls
    Credits: 9to5google
    Resizable
    Picture-in-Picture

    View full-size slide

  14. GDG Lahore
    Credits: 9to5google
    Screen Recorder
    ● Native screen recording
    ○ Quick settings tile
    ○ No more third parties

    View full-size slide

  15. GDG Lahore
    Privacy

    View full-size slide

  16. GDG Lahore
    Credits: VentureBeat
    Permissions
    ● One-time permissions
    ○ lets users give an app access to the device
    microphone, camera, or location, just that
    one time
    ● Permissions auto-reset
    ○ Android 11 will “auto-reset” all of the
    runtime permissions of the app if its not
    used for a while (e.g. 3 months)
    ● Background location
    ○ Developers will need to get approval to
    access background location in their app to
    prevent misuse

    View full-size slide

  17. GDG Lahore
    Developers

    View full-size slide

  18. GDG Lahore
    Window Insets
    ● More information about the
    multiple types of content being
    displayed
    ○ Status, navigation, IME, ...

    View full-size slide

  19. GDG Lahore
    WindowInsets
    // get WindowInsets object from listener
    view.setOnApplyWindowInsetsListener { view, insets ->
    // See if the IME is visible
    val imeVisible = insets.isVisible((WindowInsets.Type.ime()))
    if (imeVisible) {
    val imeInsets = insets.getInsets(WindowInsets.Type.ime())
    // ...
    }
    }

    View full-size slide

  20. GDG Lahore
    IME Animations
    ● Synchronize keyboard animations
    with app content changes
    ○ Listen for changes
    ■ AND/OR
    ○ Drive keyboard animation
    directly

    View full-size slide

  21. GDG Lahore
    IME Animations

    View full-size slide

  22. GDG Lahore
    Data Access Auditing
    • Listen for when user-permission-required
    data is accessed
    • Great for large apps or use of external
    libraries

    View full-size slide

  23. GDG Lahore
    ● Callbacks invoked when
    user-permission-required data is
    accessed
    Data Access Auditing

    View full-size slide

  24. GDG Lahore
    Data Access Auditing
    val appOpsCallback = object : AppOpsManager.OnOpNotedCallback() {
    override fun onNoted(syncNotedAppOp: SyncNotedAppOp) { ... }
    override fun onSelfNoted(syncNotedAppOp: SyncNotedAppOp) { ... }
    override fun onAsyncNoted(asyncNotedAppOp: AsyncNotedAppOp) { ... }
    }
    val appOpsManager =
    getSystemService(AppOpsManager::class.java) as AppOpsManager
    appOpsManager.setOnOpNotedCallback(mainExecutor, appOpsCallback)

    View full-size slide

  25. GDG Lahore
    One-Time Permissions

    View full-size slide

  26. GDG Lahore
    ● More restrictive in Android 11
    ● First, request foreground permission
    ● Then request background permission
    ● Takes user to Settings
    Background Location

    View full-size slide

  27. GDG Lahore
    • Android 10 required manifest attribute for
    Location
    • Android 11 adds
    ○ Camera
    ○ Microphone
    Foreground Services

    View full-size slide

  28. GDG Lahore
    Foreground Service Type

    ...

    ...

    View full-size slide

  29. GDG Lahore
    Developer Goodies

    View full-size slide

  30. GDG Lahore
    Wi-Fi Debugging
    Because there are never enough USB ports

    View full-size slide

  31. GDG Lahore
    Wi-Fi Debugging
    Because there are never enough USB ports

    View full-size slide

  32. GDG Lahore
    Crash Reasons
    Reporting
    ● API to query why your app crashed
    ○ Upload reports

    View full-size slide

  33. GDG Lahore
    Crash Reasons Querying
    // Returns List of ApplicationExitInfo
    val reasonsList = activityManager.getHistoricalProcessExitReasons(
    packageName, pid /* 0 for all matches */, max /* 0 for all */)
    for (info in reasonsList) {
    // Log/store/upload info.reason
    // REASON_LOW_MEMORY, REASON_CRASH, REASON_ANR, etc.
    }

    View full-size slide

  34. GDG Lahore
    ADB Incremental
    ● Faster installs via command-line
    ● For huge APKs (think: games)
    ● Up to 10x faster

    View full-size slide

  35. GDG Lahore
    ADB Incremental
    // First: sign APK, create APK Signature Scheme v4 file
    // Then, run ADB incremental
    $ adb install --incremental

    View full-size slide

  36. GDG Lahore
    Behavior Changes
    ● Most changes limited to targetSdk R
    ● Test changes with behavior toggles
    ○ Command-line
    ○ New Developer Options panel

    View full-size slide

  37. GDG Lahore
    Toggling Behavior Changes
    // adb shell am compat (enable|disable) (CHANGE_ID|CHANGE_NAME) \ PACKAGE_NAME
    $ adb shell am compat disable DEFAULT_SCOPED_STORAGE \
    com.android.samples.android11playground

    View full-size slide

  38. GDG Lahore
    But Wait, There’s More!
    https://android-developers.googleblog.com/2020/06/unwrapping-android-11-beta-plus-more.html
    #11WeeksOfAndroid

    View full-size slide

  39. Thank you!
    @WajahatKarim
    wajahatkarim.com youtube.com/c/wajahatkarim3

    View full-size slide