Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

GDG Lahore

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

GDG Lahore People

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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/

Slide 8

Slide 8 text

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.

Slide 9

Slide 9 text

GDG Lahore Controls

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

GDG Lahore Privacy

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

GDG Lahore Developers

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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()) // ... } }

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

GDG Lahore IME Animations

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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)

Slide 26

Slide 26 text

GDG Lahore One-Time Permissions

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

GDG Lahore Foreground Service Type ... ...

Slide 30

Slide 30 text

GDG Lahore Developer Goodies

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

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