arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1701.05467cs.SE
收藏

修复Android应用中的数据丢失问题

Healing Data Loss Problems in Android Apps

Oliviero Riganelli, Daniela Micucci, Leonardo Mariani

摘要:

Android应用程序应该设计为应对停止-启动事件,这些事件需要停止和恢复应用程序的执行,同时保持其状态不变。这些事件可能是由运行时配置更改(如屏幕旋转)和上下文切换(如从一个应用切换到另一个应用)引起的。当发生stop-start事件时,Android会保存应用的状态,处理事件,并最终恢复保存的状态。为了让Android正确保存和恢复状态,应用必须提供相应的支持。不幸的是,Android开发人员经常错误地实现这种支持,或者根本没有实现它。这种糟糕的做法使应用程序对停止-启动事件做出错误的反应,从而产生我们定义的数据丢失问题,即丢失用户数据的Android应用程序,由于程序变量丢失其值而导致意外行为和崩溃。数据丢失问题很难检测,因为只有当应用程序处于特定状态并具有特定输入时才可能观察到数据丢失问题。覆盖所有可能的测试用例可能需要大量的测试用例,这些测试用例的执行必须手动检查,以发现在每个停止-启动事件之后,测试中的应用程序是否已正确恢复。因此,重要的是要补充传统的内部测试活动与机制,可以保护应用程序,一旦在现场发生数据丢失问题。在本文中,我们提出了DataLossHealer,一种自动识别和修复数据丢失问题的技术,一旦发生在现场。DataLossHealer是一种在运行时检查状态是否正确恢复的技术,并在需要时修复应用程序。DataLossHealer可以从经验中学习,逐步减少引入的开销,避免监视过去由应用程序正确管理的交互。

英文摘要:

Android apps should be designed to cope with stop-start events, which are the events that require stopping and restoring the execution of an app while leaving its state unaltered. These events can be caused by run-time configuration changes, such as a screen rotation, and by context-switches, such as a switch from one app to another. When a stop-start event occurs, Android saves the state of the app, handles the event, and finally restores the saved state. To let Android save and restore the state correctly, apps must provide the appropriate support. Unfortunately, Android developers often implement this support incorrectly, or do not implement it at all. This bad practice makes apps to incorrectly react to stop-start events, thus generating what we defined data loss problems, that is Android apps that lose user data, behave unexpectedly, and crash due to program variables that lost their values. Data loss problems are difficult to detect because they might be observed only when apps are in specific states and with specific inputs. Covering all the possible cases with testing may require a large number of test cases whose execution must be checked manually to discover whether the app under test has been correctly restored after each stop-start event. It is thus important to complement traditional in-house testing activities with mechanisms that can protect apps as soon as a data loss problem occurs in the field. In this paper we present DataLossHealer, a technique for automatically identifying and healing data loss problems in the field as soon as they occur. DataLossHealer is a technique that checks at run-time whether states are recovered correctly, and heals the app when needed. DataLossHealer can learn from experience, incrementally reducing the overhead that is introduced avoiding to monitor interactions that have been managed correctly by the app in the past.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑