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
Recreating Android Activity
Running
(visible)
Destroyed
Created
Running
(visible)
create activity restore activity state
save activity state1
2 3
https://disco.unimib.it
oliviero.riganelli
………….
Instance State
https://disco.unimib.it
oliviero.riganelli
………….
Recreating an Activity
https://disco.unim
ib.it
oliviero.riganelli
………….Running
(visible)
Destroyed
save activity state1
https://disco.unimib.it
oliviero.riganelli
………….
Instance State
Recreating an Activity
https://disco.unimib.it
oliviero.riganelli
………….
Created
create activity2
https://disco.unim
ib.it
oliviero.riganelli
………….
Instance State
Recreating an Activity
https://disco.unimib.it
oliviero.riganelli
………….
https://disco.unimib.it
oliviero.riganelli
………….
Created
Running
(visible)
restore activity state3
Instance State
Recreating an Activity
https://disco.unimib.it
oliviero.riganelli
………….
Data Loss
Instance State
https://disco.unimib.it
oliviero.riganelli
………….
https://disco.unim
ib.it
Running
(visible)
Destroyed
save activity state1
https://disco.unimib.it
oliviero.riganelli
………….
Data Loss
Instance State
https://disco.unimib.it
oliviero.riganelli
………….
Created
create activity2
https://disco.unim
ib.it
Instance State
Data Loss
https://disco.unimib.it
oliviero.riganelli
………….
https://disco.unimib.it
Created
Running
(visible)
restore activity state3
Instance State
Data Loss
https://disco.unimib.it
oliviero.riganelli
………….
https://disco.unimib.it
Created
Running
(visible)
restore activity state3
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
Pervasiveness of Data Loss
Problems
APP APP APP APP APP
Pervasiveness of Data Loss
Problems
88%
Apps with data loss
12%
App without data loss
Pervasiveness of Data Loss
Problems
88%
Apps with data loss
12%
App without data loss
Pervasiveness of Data Loss
Problems
88%
Apps with data loss
12%
App without data loss
Pervasiveness of Data Loss
Problems
88%
Apps with data loss
12%
App without data loss
Data Loss Detector (DLD)
https://disco.unimib.it
oliviero.riganelli
………….
https://disco.unimib.it
Data Loss Detector (DLD)
Touch buttons
Type text
Press HOME key
…
Data Loss Detector (DLD)
Touch buttons
Type text
Press HOME key
…
GrantPermissionsActivity
<FIRST>
GrantPermissionsActivity
TouchEvent(“ALLOW”) TouchEvent(“ALLOW”)
TouchEvent(“3”)
MainActivity
MainActivity
Launcher
KeyEvent(HOME)
GUI Model
TouchEvent(“3”)
GrantPermissionsActivity
<FIRST>
GrantPermissionsActivity MainActivity
MainActivity
Launcher
TouchEvent(“ALLOW”) TouchEvent(“ALLOW”)
KeyEvent(HOME)
GUI Model
GUI:
ACTIONS: KeyEvent(HOME)
TouchEvent(“ALLOW”)
…
STATE
TouchEvent(“3”)
GrantPermissionsActivity
<FIRST>
GrantPermissionsActivity MainActivity
MainActivity
Launcher
TouchEvent(“ALLOW”) TouchEvent(“ALLOW”)
KeyEvent(HOME)
GUI Model
Type: Touch
View:
Command: adb shell input …
EVENT
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
TouchEvent(“OK”)
Sn
TouchEvent(“NO THANKS”)
KeyEvent(MENU)
Biased Model-Based Exploration
Sn
KeyEvent(MENU)
Biased Model-Based Exploration
90% Unexecuted event 10% Any event
TouchEvent(“OK”)
TouchEvent(“NO THANKS”)
Sn
KeyEvent(MENU)
Biased Model-Based Exploration
P:0.333
P:0.333
P:0.333
90% Unexecuted event 10% Any event
TouchEvent(“OK”)
TouchEvent(“NO THANKS”)
Sn
KeyEvent(MENU)
Biased Model-Based Exploration
P:0.333
P:0.333
P:0.333
90% Unexecuted event 10% Any event
TouchEvent(“OK”)
TouchEvent(“NO THANKS”)
Sn
KeyEvent(MENU)
Biased Model-Based Exploration
P:0.033
P:0.483
P:0.483
90% Unexecuted event 10% Any event
TouchEvent(“OK”)
TouchEvent(“NO THANKS”)
Sn
KeyEvent(MENU)
Biased Model-Based Exploration
90% Unexecuted event 10% Any event
TouchEvent(“OK”)
TouchEvent(“NO THANKS”)
P:0.033
P:0.483
P:0.483
Sn
KeyEvent(MENU)
Biased Model-Based Exploration
P:0.033
P:0.933
P:0.033
90% Unexecuted event 10% Any event
TouchEvent(“OK”)
TouchEvent(“NO THANKS”)
Data-Loss-Revealing Actions
NEW STATE
Systematic
Probabilistic
ALREADY VISITED STATE
Systematic data-loss-revealing action
https://
oliviero.riganelli
………….
Systematic data-loss-revealing action
https://
oliviero.riganelli
………….
https://disco.unimib.it
oliviero.riganelli
………….
https://
oliviero.riganelli
………….
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
Probabilistic data-loss-revealing actionhttps://
oliviero.rig
………….
https://
oliviero.rig
…
…
…
…
.
https://
oliviero.riganelli
…
…
…
…
.
https://
oliviero.rig
…
…
…
…
.
https://
oliviero.riganelli
…
…
…
…
.
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
Data Loss Oracles
Snapshot
Property
…
‘content_description':
…
…
‘content_description':
...
Before double rotation After double rotation
Data Loss Oracles
Snapshot
Property
…
‘content_description':
'Open navigation
drawer',
…
…
‘content_description':
‘Close navigation
drawer',
...
Before double rotation After double rotation
EvaluationEvaluation
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.
RQ1 - How effective is DLD
with data loss problems?
110
Benchmark Data Loss
RQ1 - How effective is DLD
with data loss problems?
27 83 267
Benchmark Data Loss Detected by DLD
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
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
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
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
https://github.com/datalossdetector/DLD
Get Your Copy
Now!!!

Data loss detector: automatically revealing data loss bugs in Android apps