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

Cb3e26de5b49f50cc74a98a7729b3f93?s=128

Wajahat Karim

July 04, 2020
Tweet

Transcript

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

    Expert in Android wajahatkarim.com
  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
  3. GDG Lahore

  4. GDG Lahore So… what is new? What’s new about What’s

    New in Android? People Controls Privacy
  5. GDG Lahore People

  6. GDG Lahore Credits: OneSignal Conversations • Dedicated section at top

    of the notifications ◦ Only for chat / messaging apps
  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/
  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.
  9. GDG Lahore Controls

  10. GDG Lahore Credits: CNET Quick Controls • Triggers on long

    press Power button ◦ Power off options ◦ Google Play cards ◦ Smart Home device controls
  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
  12. GDG Lahore Credits: MashTips Share Menu • Pin Apps in

    Share Menu ◦ Allows faster sharing
  13. GDG Lahore • Scheduling dark mode ◦ All time dark

    or light ◦ Switch between dark / light at specific times Credits: MashTips Improved Dark Mode
  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
  15. GDG Lahore Credits: 9to5google Screen Recorder • Native screen recording

    ◦ Quick settings tile ◦ No more third parties
  16. GDG Lahore Privacy

  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
  18. GDG Lahore Developers

  19. GDG Lahore Window Insets • More information about the multiple

    types of content being displayed ◦ Status, navigation, IME, ...
  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()) // ... } }
  21. GDG Lahore IME Animations • Synchronize keyboard animations with app

    content changes ◦ Listen for changes ▪ AND/OR ◦ Drive keyboard animation directly
  22. GDG Lahore IME Animations

  23. GDG Lahore Data Access Auditing • Listen for when user-permission-required

    data is accessed • Great for large apps or use of external libraries
  24. GDG Lahore • Callbacks invoked when user-permission-required data is accessed

    Data Access Auditing
  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)
  26. GDG Lahore One-Time Permissions

  27. GDG Lahore • More restrictive in Android 11 • First,

    request foreground permission • Then request background permission • Takes user to Settings Background Location
  28. GDG Lahore • Android 10 required manifest attribute for Location

    • Android 11 adds ◦ Camera ◦ Microphone Foreground Services
  29. GDG Lahore Foreground Service Type <manifest> ... <service ... android:foregroundServiceType="camera|microphone"

    /> ... </manifest>
  30. GDG Lahore Developer Goodies

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

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

    ports
  33. GDG Lahore Crash Reasons Reporting • API to query why

    your app crashed ◦ Upload reports
  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. }
  35. GDG Lahore ADB Incremental • Faster installs via command-line •

    For huge APKs (think: games) • Up to 10x faster
  36. GDG Lahore ADB Incremental // First: sign APK, create APK

    Signature Scheme v4 file // Then, run ADB incremental $ adb install --incremental
  37. GDG Lahore Behavior Changes • Most changes limited to targetSdk

    R • Test changes with behavior toggles ◦ Command-line ◦ New Developer Options panel
  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
  39. GDG Lahore But Wait, There’s More! https://android-developers.googleblog.com/2020/06/unwrapping-android-11-beta-plus-more.html #11WeeksOfAndroid

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