一句话:提出流、上下文、对象与字段敏感的过程间静态分析,检测 Android 应用中 AsyncTask 的五类误用。
针对 Android 智能手机资源受限背景下 AsyncTask 被广泛使用却易遭误用的问题,本文通过调研官方文档和技术论坛总结了五类 AsyncTask 误用模式。为自动检测这些模式,作者提出一种流、上下文、对象和字段敏感的过程间静态分析方法,包括 typestate 分析、引用分析和循环分析,并依据预定义检测规则判定误用。该方法实现为工具 AsyncChecker,在自建基准 AsyncBench 和 1,759 个真实应用上评估。AsyncChecker 在 1,417 个真实应用中(80.6%)发现 17,946 个误用 AsyncTask 实例,精确率 97.2%、召回率 89.8%、F-measure 0.93,并比现有工具能检测更多异步问题。开发者经 GitHub 确认并修复了部分问题。
Facing the limited resource of smartphones, asynchronous programming significantly improves the performance of Android applications. Android provides several packaged components to ease the development of asynchronous programming. Among them, the AsyncTask component is widely used by developers since it is easy to implement. However, the abuse of AsyncTask component can decrease responsiveness and even lead to crashes. By investigating the Android Developer Documentation and technical forums, we summarize five misuse patterns about AsyncTask. To detect them, we propose a flow, context, object and field-sensitive inter-procedural static analysis approach. Specifically, the static analysis includes typestate analysis, reference analysis and loop analysis. Based on the AsyncTask-related information obtained during static analysis, we check the misuse according to predefined detection rules. The proposed approach is implemented into a tool called AsyncChecker. We evaluate AsyncChecker on a self-designed benchmark suite called AsyncBench and 1,759 real-world apps. AsyncChecker finds 17,946 misused AsyncTask instances in 1,417 real-world apps (80.6%). The precision, recall and F-measure of AsyncChecker on real-world applications are 97.2%, 89.8% and 0.93, respectively. Compared with existing tools, AsyncChecker can detect more asynchronous problems. We report the misuse problems to developers via GitHub. Several developers have confirmed and fixed the problems found by AsyncChecker. The result implies that our approach is effective and developers do take the misuse of AsyncTask as a serious problem.
DOI 原文 ·
@inproceedings{paperbot5721,
title = {Static asynchronous component misuse detection for Android applications},
author = {Linjie Pan and Baoquan Cui and Hao Liu and Jiwei Yan and Siqi Wang and Jun Yan and Jian Zhang},
booktitle = {FSE},
year = {2020},
doi = {10.1145/3368089.3409699}
}