一句话:识别 Android Activity/Fragment 的三种变体生命周期,并提出 VALA 自动检测由此引发的资源利用缺陷。
Android 组件(如 Activity 和 Fragment)的生命周期模型预定义回调方法的可能调用顺序,资源利用操作必须符合所有可能生命周期,否则可能引发资源泄漏或数据丢失。现有技术多关注常见生命周期,忽视了非常见回调顺序造成的变体生命周期。本文识别出 Activity 和 Fragment 的三种变体生命周期,并提出 VALA 技术,自动检测由这些变体生命周期引发、可能导致资源利用错误的 Android 应用缺陷。在 35 个 Android 应用上的实验评估中,VALA 的支持工具自动检测到 8 个资源利用缺陷;所有缺陷均经人工确认为真实缺陷,其中 7 个为首次报告。
The lifecycle models of Android components such as Activities and Fragments predefine the possible orders in which the components' callback methods will be invoked during app executions. Correspondingly, resource utilization operations performed by Android components must comply with all possible lifecycles to ensure safe utilization of the resources in all circumstances, which, however, can be challenging to achieve. In response to the challenge, various techniques have been developed to detect resource utilization bugs that manifest themselves when components go through common lifecycles, but the fact that Android components may execute their callback methods in uncommon orders, leading to variant component lifecycles, has largely been overlooked by the existing techniques. In this paper, we first identify three variant lifecycles for Android Activities and Fragments and then develop a technique called VALA to automatically detect bugs in Android apps that are induced by the variant lifecycles and may cause resource utilization errors like resource leaks and data losses. In an experimental evaluation conducted on 35 Android apps, a supporting tool for the VALA technique automatically detected 8 resource utilization bugs. All the 8 bugs were manually confirmed to be real defects and 7 of them were reported for the first time.