Towards Automatic Detection and Repair of Compatibility Issues in Android Apps

The Hong Kong University of Science and Technology
Department of Computer Science and Engineering


PhD Thesis Defence


Title: "Towards Automatic Detection and Repair of Compatibility Issues in
Android Apps"

By

Mr. Huaxun HUANG


Abstract:

Android is a fast-evolving operating system for mobile phones. The API
specifications of the Android framework constantly change due to the release of
new versions. As a result, compatibility issues arise when developers are
unable to adapt their apps to such Android framework changes. Such
compatibility issues have been recognized as a major challenge of app
developers. To help resolve this challenge, in this thesis, we empirically
investigated how the Android framework changes can induce various types of
compatibility issues. Moreover, we propose a series of solutions to
automatically detect and repair compatibility issues in Android apps.
Specifically, this thesis focuses on the following two aspects:

(1) Compatibility issues in XML configuration files (Configuration
Compatibility Issues). XML configuration files are widely used in Android apps
to render user interfaces (UIs) and provide essential information for
execution. However, configuration compatibility issues can be incurred when the
processing of these configuration files is inconsistent across different
Android API levels. From the perspective of app developers, the manual effort
of issue detection can be non-trivial given the large number of XML
configuration files in a typical Android app. Moreover, there is no universal
solution available to resolve configuration compatibility issues and app
developers need to diagnose the issues and resolve them case by case. To bridge
such gaps, we conducted a systematic study by analyzing 196 real-world issues
collected from 43 popular apps. Specifically, we first identified common
patterns of Android framework code changes that induce such configuration
compatibility issues. We propose ConfDroid, which automatically extract
issue-detection rules from the Android framework changes. Furthermore, we
empirically studied the common strategies adopted by app developers to repair
configuration compatibility issues. With the empirical finding, we propose
ConfFix, which is driven by the knowledge of how an XML configuration file is
handled inconsistently in different versions of the Android framework and
generates patches to eliminate such inconsistencies. The evaluation results
show that all the above-proposed techniques outperform the state-of-the-art
methods and receive positive feedback from app developers.

(2) Compatibility issues induced by Android framework APIs (API-induced
Compatibility Issues). The implementation of Android apps relies on the Android
framework APIs. The APIs on which Android apps depend may undergo changes,
which result in API-Induced Compatibility Issues (AIC issues for short). In
this thesis, we aim at studying automated detection and repair of AIC issues in
Android apps. We first conduct research on callback compatibility issues, which
are a major type of AIC issues. The Android apps respond to system events
(e.g., click events) by overriding callback APIs in the Android framework.
However, the timing of invoking the callback APIs may change with the update of
the Android version, resulting in callback compatibility issues. Such issues
mainly affect the apps' control flow and data flow. In this thesis, we
collected 100 real callback compatibility issues and then investigated how the
Android framework changes can induce such issues. We further design CIDER,
which facilitates automated issue detection with modelling the execution order
of callback APIs across Android framework versions. The evaluation shows that
CIDER outperforms the state-of-the-art approaches with high precision. For the
AIC issue repair, existing tools are driven a set of issue-fixing templates
refined from examples of other developers. However, these approaches are not
applicable in practice as they require the code under repair to be
syntactically similar to the issue-fixing templates. Recent advances in GPT
models have shown their potential in repairing software bugs by leveraging
knowledge from a large corpus of training dataset on the Internet. Motivated by
this, we conducted an empirical study to evaluate the effectiveness and
limitations of state-of-the-art GPT models in fixing AIC issues. The results
show that GPT models can repair AIC issues to some extent, but there is still
room for improvement in their repair capabilities. The results of our study
also indicate the need for useful information from both the Android framwork
and app context to improve the capabilities of GPT models in repairing AIC
issues.


Date:                   Tuesday, 25 July 2023

Time:                   10:00am - 12:00noon

Venue:                  Room 3494
                        lifts 25/26

Chairperson:            Prof. Ki Ling CHEUNG (ISOM)

Committee Members:      Prof. Shing-Chi CHEUNG (Supervisor)
                        Prof. Shuai WANG
                        Prof. Raymond WONG
                        Prof. Jun ZHANG (ECE)
                        Prof. Qing LI (PolyU)


**** ALL are Welcome ****