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

  3. GDG Lahore

    View Slide

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

    View Slide

  5. GDG Lahore
    People

    View Slide

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

    View Slide

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

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

  9. GDG Lahore
    Controls

    View Slide

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

    View Slide

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

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

    View Slide

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

    View Slide

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

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

    View Slide

  16. GDG Lahore
    Privacy

    View Slide

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

  18. GDG Lahore
    Developers

    View Slide

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

    View Slide

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

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

    View Slide

  22. GDG Lahore
    IME Animations

    View Slide

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

    View Slide

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

    View Slide

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

  26. GDG Lahore
    One-Time Permissions

    View Slide

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

    View Slide

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

    View Slide

  29. GDG Lahore
    Foreground Service Type

    ...

    ...

    View Slide

  30. GDG Lahore
    Developer Goodies

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

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

    View Slide

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

    View Slide

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

    View Slide

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

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

    View Slide

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

    View Slide