Slide 1

Slide 1 text

Data Loss Detector: Automatically Revealing Data Loss Bugs in Android Apps Oliviero Riganelli University of Milano Bicocca joint work with Simone Paolo Mottadelli, Claudio Rota, Daniela Micucci and Leonardo Mariani Distinguished Artifact

Slide 2

Slide 2 text

Recreating Android Activity https://disco.unimib.it oliviero.riganelli …………. https://disco.unimib.it oliviero.riganelli ………….

Slide 3

Slide 3 text

Recreating Android Activity Running (visible) Destroyed Created Running (visible) create activity restore activity state save activity state 1 2 3

Slide 4

Slide 4 text

https://disco.unimib.it oliviero.riganelli …………. Instance State https://disco.unimib.it oliviero.riganelli …………. Recreating an Activity

Slide 5

Slide 5 text

https://disco.unim ib.it oliviero.riganelli …………. Running (visible) Destroyed save activity state 1 https://disco.unimib.it oliviero.riganelli …………. Instance State Recreating an Activity

Slide 6

Slide 6 text

https://disco.unimib.it oliviero.riganelli …………. Created create activity 2 https://disco.unim ib.it oliviero.riganelli …………. Instance State Recreating an Activity

Slide 7

Slide 7 text

https://disco.unimib.it oliviero.riganelli …………. https://disco.unimib.it oliviero.riganelli …………. Created Running (visible) restore activity state 3 Instance State Recreating an Activity

Slide 8

Slide 8 text

https://disco.unimib.it oliviero.riganelli …………. Data Loss Instance State https://disco.unimib.it oliviero.riganelli ………….

Slide 9

Slide 9 text

https://disco.unim ib.it Running (visible) Destroyed save activity state 1 https://disco.unimib.it oliviero.riganelli …………. Data Loss Instance State

Slide 10

Slide 10 text

https://disco.unimib.it oliviero.riganelli …………. Created create activity 2 https://disco.unim ib.it Instance State Data Loss

Slide 11

Slide 11 text

https://disco.unimib.it oliviero.riganelli …………. https://disco.unimib.it Created Running (visible) restore activity state 3 Instance State Data Loss

Slide 12

Slide 12 text

https://disco.unimib.it oliviero.riganelli …………. https://disco.unimib.it Created Running (visible) restore activity state 3 Instance State Data Loss The metronome is frustrating. I use it when I practice but if I ever stop it, and turn off the screen, it resets to 40bpm and 4/4 time As soon as I opened a comic through this app I was really happy given its functionality and ease of use. But everytime I rotate the screen, the app exits saying " file could not be loaded" Randomly sets back to 100% and auto brightness after using camera

Slide 13

Slide 13 text

Pervasiveness of Data Loss Problems APP APP APP APP APP

Slide 14

Slide 14 text

Pervasiveness of Data Loss Problems 88% Apps with data loss 12% App without data loss

Slide 15

Slide 15 text

Pervasiveness of Data Loss Problems 88% Apps with data loss 12% App without data loss

Slide 16

Slide 16 text

Data Loss Detector (DLD) https://disco.unimib.it oliviero.riganelli …………. https://disco.unimib.it

Slide 17

Slide 17 text

Data Loss Detector (DLD) Touch buttons Type text Press HOME key …

Slide 18

Slide 18 text

Data Loss Detector (DLD) Touch buttons Type text Press HOME key …

Slide 19

Slide 19 text

TouchEvent(“3”) GrantPermissionsActivity GrantPermissionsActivity MainActivity MainActivity Launcher TouchEvent(“ALLOW”) TouchEvent(“ALLOW”) KeyEvent(HOME) GUI Model

Slide 20

Slide 20 text

TouchEvent(“3”) GrantPermissionsActivity GrantPermissionsActivity MainActivity MainActivity Launcher TouchEvent(“ALLOW”) TouchEvent(“ALLOW”) KeyEvent(HOME) GUI Model GUI: ACTIONS: KeyEvent(HOME) TouchEvent(“ALLOW”) … STATE

Slide 21

Slide 21 text

TouchEvent(“3”) GrantPermissionsActivity GrantPermissionsActivity MainActivity MainActivity Launcher TouchEvent(“ALLOW”) TouchEvent(“ALLOW”) KeyEvent(HOME) GUI Model Type: Touch View: Command: adb shell input … EVENT

Slide 22

Slide 22 text

https://disco.unimib.it oliviero.riganelli …………. Data Loss Detector (DLD) oliviero.riganelli Love is the answer Biased Model-Based Exploration Data Loss Oracles Data-Loss-Revealing Actions

Slide 23

Slide 23 text

TouchEvent(“OK”) Sn TouchEvent(“NO THANKS”) KeyEvent(MENU) Biased Model-Based Exploration

Slide 24

Slide 24 text

Sn KeyEvent(MENU) Biased Model-Based Exploration 0.9 Unexecuted event 0.1 Any event TouchEvent(“OK”) TouchEvent(“NO THANKS”)

Slide 25

Slide 25 text

Sn KeyEvent(MENU) Biased Model-Based Exploration P:0.333 P:0.333 P:0.333 TouchEvent(“OK”) TouchEvent(“NO THANKS”) 0.9 Unexecuted event 0.1 Any event

Slide 26

Slide 26 text

Sn KeyEvent(MENU) Biased Model-Based Exploration P:0.333 P:0.333 P:0.333 TouchEvent(“OK”) TouchEvent(“NO THANKS”) 0.9 Unexecuted event 0.1 Any event

Slide 27

Slide 27 text

Sn KeyEvent(MENU) Biased Model-Based Exploration P:0.033 P:0.483 P:0.483 TouchEvent(“OK”) TouchEvent(“NO THANKS”) 0.9 Unexecuted event 0.1 Any event

Slide 28

Slide 28 text

Sn KeyEvent(MENU) Biased Model-Based Exploration TouchEvent(“OK”) TouchEvent(“NO THANKS”) P:0.033 P:0.483 P:0.483 0.9 Unexecuted event 0.1 Any event

Slide 29

Slide 29 text

Sn KeyEvent(HOME) Biased Model-Based Exploration P:0.033 P:0.933 P:0.033 TouchEvent(“OK”) TouchEvent(“NO THANKS”) 0.9 Unexecuted event 0.1 Any event

Slide 30

Slide 30 text

Data-Loss-Revealing Actions NEW STATE Systematic Probabilistic ALREADY VISITED STATE

Slide 31

Slide 31 text

Systematic data-loss-revealing action https:// oliviero.riganelli ………….

Slide 32

Slide 32 text

Systematic data-loss-revealing action https:// oliviero.riganelli …………. https://disco.unimib.it oliviero.riganelli …………. https:// oliviero.riganelli ………….

Slide 33

Slide 33 text

https:// oliviero.riganelli …………. https://disco.unimib.it oliviero.riganelli …………. https:// oliviero.riganelli …………. https:// oliviero.riganelli … … … … . https://disco.unim ib.it Systematic data-loss-revealing action

Slide 34

Slide 34 text

Probabilistic data-loss-revealing action https:// oliviero.rig …………. https:// oliviero.rig … … … … . https:// oliviero.riganelli … … … … . https:// oliviero.rig … … … … . https:// oliviero.riganelli … … … … .

Slide 35

Slide 35 text

Data Loss Oracles [ … { 'content_description': None, 'resource_id': None, 'text': 'Editing "test123"', 'visible': True, 'checkable': False, 'children': [], 'size': '720*81', 'checked': False, 'temp_id': 4, 'selected': False, 'child_count': 0, ... } ... ] Snapshot-based oracle Property-based oracle

Slide 36

Slide 36 text

Data Loss Oracles Snapshot Property … ‘content_description': … … ‘content_description': ... Before double rotation After double rotation

Slide 37

Slide 37 text

Data Loss Oracles Snapshot Property … ‘content_description': 'Open navigation drawer', … … ‘content_description': ‘Close navigation drawer', ... Before double rotation After double rotation

Slide 38

Slide 38 text

Evaluation Evaluation Research Questions APPs Configuration Google Nexus 5 Android 6.0 RQ0 - What is the ε that provides the best exploration? RQ1 - How effective is DLD with data loss problems? RQ2 - Is DLD more effective than state- of-the-art techniques? RQ3 - What is the tradeoff between the snapshot- and property- based oracles? RQ4 - Are data loss faults relevant to developers? 110 real data loss 54 app releases Riganelli et al. "A Benchmark of Data Loss Bugs for Android Apps”, MSR 2019.

Slide 39

Slide 39 text

RQ1 - How effective is DLD with data loss problems? 110 Benchmark Data Loss

Slide 40

Slide 40 text

RQ1 - How effective is DLD with data loss problems? 27 83 267 Benchmark Data Loss Detected by DLD

Slide 41

Slide 41 text

RQ1 - How effective is DLD with data loss problems? 27 83 267 Benchmark Data Loss Detected by DLD 90% of faults confirmed by developers, see RQ4 in the paper

Slide 42

Slide 42 text

RQ2 - Is DLD more effective than state-of-the-art techniques? 0 50 100 150 200 Faulty Activity Benchmark Faults New Faults Spuriuos Violations Alaric DLD

Slide 43

Slide 43 text

RQ2 - Is DLD more effective than state-of-the-art techniques? 0 50 100 150 200 Faulty Activity Benchmark Faults New Faults Spuriuos Violations Alaric DLD COMPARISON TO QUANTUM IN THE PAPER

Slide 44

Slide 44 text

RQ3 - What is the tradeoff between the snapshot- and property- based oracles? 73% 18% 9% snapshot-based oracle property-based oracle both incomplete rotation 74% 21% 5% Data loss detected Spurious oracle violations

Slide 45

Slide 45 text

RQ3 - What is the tradeoff between the snapshot- and property- based oracles? 73% 18% 9% snapshot-based oracle property-based oracle both incomplete rotation 74% 21% 5% Data loss detected Spurious oracle violations 0.1%

Slide 46

Slide 46 text

https://github.com/datalossdetector/DLD Get Your Copy Now!!!