1 Runtime Permission Issues in Android Apps: Taxonomy, Practices, and Ways Forward

Ying Wang, Yibo Wang, Sinan Wang, Yepang Liu†, Chang Xu Senior Member, IEEE, Shing-Chi Cheung Senior Member, IEEE, Hai Yu, and Zhiliang Zhu

Abstract—Android introduces a new permission model that allows apps to request permissions at runtime rather than at the installation time since 6.0 (Marshmallow, API level 23). While this runtime permission model provides users with greater flexibility in controlling an app’s access to sensitive data and system features, it brings new challenges to app development. First, as users may grant or revoke permissions at any time while they are using an app, developers need to ensure that the app properly checks and requests required permissions before invoking any permission-protected APIs. Second, Android’s permission mechanism keeps evolving and getting customized by device manufacturers. Developers are expected to comprehensively test their apps on different Android versions and device models to make sure permissions are properly requested in all situations. Unfortunately, these requirements are often impractical for developers. In practice, many Android apps suffer from various runtime permission issues (ARP issues). While existing studies have explored ARP issues, the understanding of such issues is still preliminary. To better characterize ARP issues, we performed an empirical study using 135 Stack Overflow posts that discuss ARP issues and 199 real ARP issues archived in popular open-source Android projects on GitHub. Via analyzing the data, we observed 11 types of ARP issues that commonly occur in Android apps. For each type of issues, we systematically studied: (1) how they can be manifested, (2) how pervasive and serious they are in real-world apps, and (3) how they can be fixed. We also analyzed the evolution trend of different types of issues from 2015 to 2020 to understand their impact on the Android ecosystem. Furthermore, we conducted a field survey and in-depth interviews among practitioners, to gain insights from industrial practices and learn practitioners’ requirements of tools that can help combat ARP issues. Finally, to understand the strengths and weaknesses of the existing ARP issue detectors, we built ARPBENCH, an open benchmark consisting of 94 real ARP issues, and evaluated the performance of three available ARP issue detectors. The experimental results indicate that the existing tools have very limited supports for detecting our observed issue types and report a large number of false alarms. We further analyzed the tools’ limitations and summarized the challenges of designing an effective ARP issue detection technique. We hope that our findings can shed light on future research and provide useful guidance to practitioners.

Index Terms—Runtime Permission, Android Apps, Empirical Study. !

1 INTRODUCTION sion model was vulnerable and caused many undesirable consequences [6]. For security enhancement, Android 6.0 HE permission mechanism plays a significant role in introduced a runtime permission model that lets apps request securing Android apps [1]. According to the official T permissions at runtime instead of at the installation time. Android documentation [2], to access sensitive user data With the new model, users can approve or deny an app’s (e.g., photos and contacts) or critical system features (e.g., permission requests at their discretion. Additionally, users camera and GPS), an Android app needs to request the cor- are allowed to grant or revoke permissions anytime via responding dangerous permissions first. Prior to Android 6.0 changing system settings. (Marshmallow, API level 23), users must grant all permis- sions that an app asks for at the installation time in order to While the runtime permission model improves system arXiv:2106.13012v1 [cs.SE] 24 Jun 2021 successfully install the app [3,4]. Once installed, the app will security, permission handling has become a non-trivial task be able to access all permitted user data or system features for app developers since Android 6.0, mainly due to the without further permission checks [5]. This “static” permis- following three reasons:

Ying Wang, Yibo Wang, Hai Yu, and Zhiliang Zhu are with the Software Col- • Unpredictable user interactions: First of all, users’ lege, Northeasthern University, China. E-mail: [email protected], permission-control actions can be highly unpredictable. [email protected], {yuhai, zzl}@mail.neu.edu.cn. If users deny or revoke the permissions required by Sinan Wang and Yepang Liu are with the Department of Computer certain APIs, apps using such permission-protected APIs Science and Engineering, and Guangdong Provincial Key Laboratory of Brain-inspired Intelligent Computation, Southern University of Science may easily crash at runtime. Thus, app developers and Technology, Shenzhen, China. E-mail: [email protected], li- should anticipate all possible user actions and carefully [email protected]. check whether the required permissions have been Chang Xu is with the State Key Lab for Novel Software Technology and the Department of Computer Science and Technology, Nanjing University, China. granted whenever the permission-protected APIs are E-mail: [email protected]. invoked to avoid buggy app behaviors. This is not an Shing-Chi Cheung is with the Department of Computer Science and Engi- easy task for developers. For example, in post 34150083 neering, The Hong Kong University of Science and Technology, Hong Kong, [7] on Stack Overflow [8] (SO for short), developers dis- China. E-mail: [email protected]. † Yepang Liu is the corresponding author. cussed when to request runtime permissions to avoid Manuscript received 2021. crashes. One accepted answer is that “In general, request 2

needed permissions as soon as you need them. This way you TABLE 1: An overview of our three studies can inform the user why you need the permission and handle Study Research question(s) Approach permission denies much easier. Think of scenarios where the user revokes the permission while your app runs: If you #1 RQ1–RQ3 Empirical study request it at startup and never check it later this could lead #2 RQ4–RQ5 Survey and interviews to unexpected behaviour or exceptions.” #3 RQ6 Experiment evaluation • Frequent evolution of APIs and permissions: Second, the Android framework keeps evolving, which often introduces or removes permission-protected APIs and • RQ2 (Pervasiveness and seriousness): How pervasive dangerous permissions. Developers should continually and serious are ARP issues in real-world Android projects? adapt their app to avoid unexpected issues when run- • RQ3 (Fixing strategies): How do Android developers fix ning on new Android versions. This is also a challeng- ARP issues? Are there common patterns? ing task for developers. If they do not actively track To address RQ1–RQ3, we collected 135 SO posts dis- the evolution of APIs and permissions, they may often cussing ARP issues with high views and up votes, and make mistakes. Take the issue discussed in SO post 199 ARP issues from 415 open-source Android projects on 58428763 [9] as an example. The developer found that GitHub [14]. Analyzing the collected data, we observed the Bluetooth scanning function of his/her app works 11 types of ARP issues and six commonly-adopted fixing on all devices except those with Android 10. The an- strategies. Besides the issue taxonomy, we also made many swer with the highest up votes revealed the root cause other interesting observations by investigating each type of of the issue: Bluetooth scanning function requires an issues. For example, in addition to the improper handling of additional permission ACCESS_BACKGROUND_LOCATION runtime permissions by an app itself, ARP issues can also be since Android 10.0. This post has been viewed more caused by the interference of third-party libraries. Section3 than 18k times, suggesting that many developers may reports our empirical findings in detail. have encountered similar issues. The above empirical study was performed based on the • Customized permission mechanism: Third, Android data collected from the open-source community. To cross- device manufacturers (e.g., Samsung and Huawei) may validate our findings gained from studying RQ1–RQ3, and customize the permission mechanism of the vanilla further understand the challenges in handling runtime per- Android when building their own mobile devices. Such missions and dealing with ARP issues, we conducted a field customization can cause confusion to developers. For survey and interviews among industry practitioners, with instance, in SO post 52781910 [10], a developer asked the aim to explore the following two research questions: how to deal with the permission “show on lock screen”, • RQ4 (Industrial practices): How do industry practitioners which is customized on Xiaomi devices. As we will handle runtime permissions in their Android projects? show later, such issues induced by manufacturers’ cus- • RQ5 (Challenges faced by practitioners): What are the tomization are common, causing immense frustration common challenges faced by the Android practitioners in to app developers. dealing with ARP issues? Because of the above-mentioned challenges, developers The survey and interviews provide a new perspective can easily make mistakes in permission handling. These of ARP issues, complementary to the empirical study. We mistakes result in various issues in Android apps. We refer will discuss the insights that we have learned from the to such issues stemming from the improper handling of run- participants’ real experiences and lessons in Section4. time permissions as Android runtime permission issues (ARP Finally, in recent years, there have been several tools that issues for short). Existing studies [11–13] have explored can help detect ARP issues in Android apps. With the issue ARP issues, but focused only on specific issue types. The taxonomy derived in our empirical study, we are intrigued issues are explored to ease app migration from the static to know how these tools would perform in practice. To this permission model prior to Android 6.0 to the new runtime end, we built ARPBENCH, an open benchmark consisting permission model. However, as we will show later, such of 94 ARP issues collected from real-world projects and explored issues are only a tip of the iceberg. The wide land- experimentally evaluated three ARP issue detectors, which scape of Android versions and device models has given rise are freely accessible to Android developers. We investigate to different types of ARP issues. Yet, there is no systematic the following research question in the experiments. study of ARP issues. The lack of understanding of the issues • RQ6 (Performance of existing ARP issue detectors) : would impede the development of useful techniques to help How do existing ARP issue detectors perform in terms of developers deal with various ARP issues. This motivates us issue detection capability and false alarm rate? to conduct a systematic research on ARP issues via three Our experiment results show that none of the evaluated studies as shown in Table 1. We briefly introduce the three detectors support detecting all the 11 types of ARP issues studies below. found in our empirical study. These detectors suffer from First, we performed an empirical study of ARP issues a high false alarm rate and miss many real issues, which in real-world Android apps to examine the following three would seriously hinder their adoption. To help build better research questions: tools in the future, we provide a detailed analysis of the • RQ1 (Issue types and causes): What are the common types limitations of existing detectors using real-world ARP issues of ARP issues in Android apps? How do the issues manifest as examples in Section5. themselves? What are their root causes? In summary, our work makes four major contributions: 3

• To the best of our knowledge, we conducted the first large-scale empirical study of ARP issues in Android apps. Based on our in-depth analysis of real issues from open-source projects, we built by far the most comprehensive taxonomy of ARP issues. Our empirical findings can shed light on future research and provide useful guidance to practitioners. • We conducted a field survey and interviews to un- derstand ARP issues from industry practitioners’ per- Fig. 1: An overview of Android’s permission mechanism spective. The survey and interviews not only validated the findings of our empirical study, but also provided Step 1: Declaration. They should first declare the re- further insights that cannot be gained by analyzing the quired dangerous permissions in the AndroidManifest.xml data from the open-source community. file (manifest file for short), which is a configuration file to • We evaluated three existing ARP issue detectors and present essential information to build tools and the Android provided a detailed analysis of their strengths and . weaknesses to guide future tool development. Step 2: Checking. Before invoking Android APIs that re- • To facilitate future research, we have released all our quire dangerous permissions (i.e., permission-protected APIs), artifacts, including ARPBENCH, the first open bench- the apps should check whether the corresponding per- mark for evaluating ARP issue detectors, on GitHub missions have already been granted by calling permission (http://arp-issues.github.io/). check APIs provided by the Android platform. One example is ContextCompat.checkSelfPermission(). If the apps al- ready have these permissions, they can proceed to invoke 2 BACKGROUND the permission-protected APIs. Otherwise, they should re- This section presents the background of our work. We define quest the permissions first. four terms to ease discussions. Step 3: Request. Starting from Marshmallow, the An- 1) Legacy platforms: We refer to the Android versions prior droid platform provides several permission request APIs to to Marshmallow (6.0) as legacy platforms. allow apps to request dangerous permissions at runtime. 2) Legacy apps: We refer to the Android apps that target One example is ActivityCompat.requestPermissions(). legacy platforms as legacy apps. Calling these APIs will bring up a dialog to interact with 3) New platforms: We refer to Android 6.0 and above as users, and users can choose to approve or deny the permis- new platforms. sion request. 4) New apps: We refer to the Android apps that target new Step 4: Handling users’ response. When the permission platforms as new apps. request dialog is closed after users make their choice, the callback method onRequestPermissionsResult() will be 2.1 Android Permission Mechanism invoked by the Android platform to handle users’ response. As shown in Figure1, on legacy platforms, users are asked The apps need to properly override this method to find out to grant the dangerous permissions required by legacy apps whether the requested permissions have been successfully or new apps at the app installation time [5]. Once the granted and take actions accordingly. apps are installed, they will be able to access all permitted According to the runtime permission model, all the resources without further permission checks. Under such a above four steps are suggested to be performed by Android permission model, users lose control of permissions after apps to request dangerous permissions. In particular, as installing apps and they have to uninstall the apps to gain new platforms allow users to revoke granted permissions, the control back [15]. For safety concerns, Android switched to avoid unexpected program behaviors, the Android doc- to a runtime permission model starting from Marshmallow umentation [2] suggests that apps should perform Step 2 to (Android 6.0). Under this model, new apps need to check check whether they have the required permissions when- and request dangerous permissions at runtime by invoking ever they intend to invoke any permission-protected API. designated APIs (see Section 2.2 for details) when they run on new platforms. The new model also provides users with 2.3 Permission Specification and Its Evolution fine-grained control over the permissions: they can choose On new platforms, dangerous permissions are organized to approve or deny permission requests, and they can also as permission groups [16]. Each dangerous permission in revoke granted permissions at any time [11]. For backward a permission group corresponds to a set of permission- compatibility, legacy apps running on new platforms still protected APIs [2]. As described in Section 2.2, before in- need to be granted all required permissions at installation. voking a permission-protected API, an app needs to request However, users of new platforms are allowed to revoke the the required permissions following the suggested steps. permissions granted to legacy apps. Such revocation could However, the Android documentation [2] does not pro- cause unexpected issues [12] as we will discuss later. vide readily available mappings between APIs and their required dangerous permissions. We call such mappings 2.2 Permission Check and Request Process API-DP mappings in our discussion. The lack of precise Apps targeting new platforms should follow four steps to API-DP mappings may cause inconvenience to app devel- request dangerous permissions [2]: opers [17]. Even worse, as the Android platform evolves, 4

RQ1: Issue Types and Causes RQ2: Pervasiveness & Seriousness RQ3: Fixing strategies Issue Patched taxonomy issues Developers’ discussions Official Android Open-source Android projects “Android runtime documentation ARP issue patches permission”

Fig. 2: An overview of our empirical study on real-world ARP issues

according to the root causes of the issues. For each type of is- 162.75k sues, we then formulated search keywords and searched the 0.40k issue trackers of representative Android projects on GitHub 22.03k for similar issues. This helped us build a large dataset of

2.98k 0.05k real-world ARP issues with buggy code and patches. Via studying the issues in this dataset, we further gained a

0.40k deeper understanding of ARP issues’ pervasiveness, seri- 0.01k ousness, as well as fixing strategies. In the remainder of this 0.05k subsection, we present our study methodology in detail.

Views Upvotes 3.1.1 Collecting SO Posts Fig. 3: The demographics of the 135 SO posts (in log scale) As abovementioned, we found no available datasets of ARP issues. Therefore, we collected a series of SO posts that API-DP mappings continually change. The impact of the discuss ARP issues. We resorted to SO data instead of open- mapping changes could be huge. For example, according source projects to bootstrap our research for two reasons. to the dataset of an existing study [18], there are 22 API- First, although there are thousands of open-source Android DP mapping changes between API level 23 (Android 6.0) apps with issue trackers on various project hosting sites and API level 24 (Android 7.0). We searched on GitHub (such as GitHub), there are no precise search keywords to and found that the concerned 22 APIs are used by 6,284 help retrieve relevant issues. Simply searching using general apps (see more discussions in Section 3.3.3). To ensure the keywords like “permission” will return a large amount of compatibility of these apps, the developers may need to issues containing substantial noises, which are hard to filter exhaustively test the apps on different Android versions and out. Second, SO is the most popular Q&A site for developers carefully adapt the apps to comply with the evolving per- to share their experience in solving programming issues and mission specification. Unfortunately, such testing and adap- SO data have been used for various software engineering tation are often impractical for app developers. As a result, research [21–23]. The posts on SO are often tagged manually many ARP issues, induced by the permission specification to categorize questions, which can facilitate our task of evolution, have occurred in real-world Android apps (e.g., searching for developers’ discussions on ARP issues. The issue #72 [19] and issue #88 [20] in Secure-preferences), as reward system of SO also allows us to identify the solutions we will discuss later. or explanations of real ARP issues from accepted answers with sufficient confidence. To collect relevant posts, we searched SO using the 3 CHARACTERIZING ARPISSUES “runtime-permission” tag and the general phrase “Android To understand ARP issues in real-world Android projects, runtime permission”. The search returned 2,907 posts. Next, we performed an empirical study. This section presents the we removed the duplicates and noises from the search methodology of our study and discusses our findings. results and kept those posts that satisfy the following three criteria. First, the programming issues discussed in the posts should be related to Android runtime permissions. Second, 3.1 Methodology the posted question should have accepted answers, which are confirmed solutions or explanations. Third, the posts Figure2 provides an overview of our empirical study. To should have attracted more than 200 views or 5 upvotes answer RQ1–RQ3, we need to study the ARP issues in real- (i.e., having received attention). With the above process, world Android projects. However, when we conducted our we obtained 135 high-quality posts. Figure3 shows the study, there were neither readily available datasets of such demographics of these posts. On average, the posts have issues nor precise keywords that can help collect ARP issues attracted 13,919 views (median: 1,657) and their associated from open-source projects. To bootstrap our research, we answers have received 56 upvotes (median: 6). resorted to developers’ discussions on Stack Overflow [8] (SO for short), the most popular question and answer site for professional programmers and enthusiast. We browsed all 3.1.2 Collecting Open-Source Projects SO posts that discuss ARP issues. Via analyzing these posts Although SO data can help us address RQ1, the posts are and referring to the official Android documentation, we rarely linked to buggy code or patches, which are required observed various types of ARP issues and built a taxonomy to investigate how developers deal with ARP issues at the 5 TABLE 2: The statistics of the subjects collected in our study

# Stars # Forks # Downloads† KLOC # Commits # Issues # Permissions # Categories Min. Max. Avg. Min. Max. Avg. Min. Max. Med. Min. Max. Avg. Min. Max. Avg. Min. Max. Avg. Min. Max. Avg. Apps 116 14,185 1,403 31 3,587 278 500+ 5×109+ 1×105+ 4.0 961.9 62.5 33 60,631 2,201 17 8,661 572 1 25 11 30 Libraries 53 39,467 6,061 27 9,816 1,355 - - - 3.0 932.9 39.7 17 22,672 970 11 8,192 551 1 15 7 - †We give the median downloads of the subjects instead of precise average value, as Google Play only provides the apps’ rough download counts.

Downloads (a) Demographics of collected 300 apps (log scale)

(b) Demographics of collected 115 libraries (log scale)

Fig. 4: Demographics of collected 415 subjects

code level. Due to this reason, we also collected open- ble, the collected subjects are popular (on average achieving source projects to study ARP issues. We first crawled the 3,732 stars), well-maintained (on average having 1,586 code latest version of all open-source apps from F-Droid [24] (we commits), diverse (apps belong to 30 different categories), used the snapshot on 1 Sep 2020) that satisfy the following and prone to ARP issues (on average declaring 9 dangerous three criteria. First, the apps should declare at least one permissions). In particular, among the collected 300 apps, dangerous permission in their manifest files. Second, the 216 of them are also released on Google Play store, and apps should have publicly accessible issue trackers and code 32 out of the above 216 apps are ranked in the top 500 in repositories on GitHub. We only considered GitHub because 13 categories. Such demographics demonstrate the repre- it is currently the most popular site to host open-source sentativeness of our collected subjects. Besides, all of these projects. Third, the apps should be popular. To measure open-source projects were started before 2015, the year that popularity, we checked an app’s star and fork counts on Google introduced the runtime permission mechanism in GitHub, as well as the download counts on Google Play Android OS. This enables us to analyze the impacts of the store [25], which is the official app store for Android. An evolution of runtime permission mechanism. app is considered popular if it ranks in the top 30% of all 3.1.3 Data Analysis apps indexed by F-Droid according to any of the three met- This subsection briefly describes how we performed data rics. In addition to apps, we also collected library projects analysis to answer RQ1–RQ3. More details will be given in that declare dangerous permissions from GitHub using the subsequent sections. keywords “Android library” because we observed that many To answer RQ1, we performed an in-depth analysis ARP issues are actually introduced by third-party libraries of the 135 SO posts. Specifically, we followed an open when filtering SO posts. Similar to apps, we only collected coding procedure [26], a widely-used approach for quali- popular libraries that rank in the top 100 according to star tative research, to categorize the issues discussed in each or fork counts. Via the above process, we obtained 300 apps post. Initially, based on the knowledge acquired from the and 115 libraries as the subjects for our study. data collection and post filtering process, we determined a Table2 reports the demographics of the 415 subjects and draft issue taxonomy and discussed how to label the issues Figure4 shows their distributions, including: (1) number mentioned in the posts according to their symptoms and of stars, (2) number of forks, (3) number of downloads on root causes. Then, three authors (annotators) of this paper, Google Play store, (4) thousand lines of code, (5) number who all have more than three years of Android development of code revisions, (6) number of issues reported in their experience, independently analyzed each post, including issue trackers, and (7) number of dangerous permissions the issue descriptions, comments, accepted answers, and registered in their manifest files. As we can see from the ta- linked resources (e.g., relevant issues on GitHub). They also 6

referred to the Android documentation to aid the under- dangerous permissions at installation. The permissions, standing of ARP issues. After the first round of indepen- once granted, cannot be revoked by users. In such scenarios, dent analysis and labeling, the three annotators gathered apps rarely suffer from permission-related issues if the to compare and discuss their results, in order to clarify developers carefully declare all required permissions in the the descriptions and boundaries of different categories, add manifest files. However, with the adoption of the runtime and remove labels, and adjust the hierarchical structures of permission model, ARP issues arise in more and more apps. categories. This led to a more clear-cut labeling strategy. We observed three typical types of such issues, which occur Next, the three annotators continued the labeling process in two different scenarios. and iteratively refined the results as well as the labeling Scenario 1: Legacy apps running on new platforms. strategy. When there were conflicting opinions during the For backward compatibility, new platforms allow legacy iterations, the other authors were invited to meetings to apps to be used by granting all dangerous permissions resolve conflicts. The annotators finally reached a consensus declared in the apps’ manifest file. However, on new on the issue taxonomy after six iterations. platforms, users can freely revoke the permissions granted To answer RQ2, we first formulated keywords for each to apps. If permission revoking happens to legacy apps, type of ARP issues observed from analyzing the SO posts to the SecurityExceptions will be thrown whenever the apps search for similar issues in the 415 GitHub projects. This invoke permission-protected APIs (Type 1 issues). A typical step resulted in a collection of 199 real ARP issues with example is issue #1343 [27] in the app Owncloud. As dis- detailed information, including the issue reports, the buggy cussed in SO post #35248269 [28], developers of such legacy code, and the patches. We then studied the issue distribution apps have no choice but to migrate their apps to use the to understand the pervasiveness of each issue type and runtime permission mechanism. Otherwise, the apps will studied the evolutionary trends of the issues by analyzing very likely receive poor user ratings, since they can easily the yearly data. We also paid special attention to the issue crash on new platforms. types that have become increasingly common in recent years Scenario 2: New apps running on new platforms. Un- and investigated their potential impact by looking at how like legacy apps, new apps request dangerous permissions many open-source projects may suffer from such issues. at runtime. Ideally, if the developers carefully implement the To answer RQ3, we studied the patches of the issues permission check and request process, these apps should collected from the 415 GitHub projects to understand how work fine on new platforms. However, Android platform developers fixed the issues and distill common strategies. evolves quickly [29]. We observed that new apps may suffer from ARP issues due to such evolution. Particularly, we observed the following two types of issues: 3.2 RQ1: Issue Types and Causes • Evolution of API-DP mappings. ARP issues may Finding 1: ARP issues not only can be caused by Android apps’ arise due to the evolution of API-DP mappings across mishandling of dangerous permissions, but also can occur due to different Android versions, including: 1) the addi- the interference of third-party libraries. tion/deletion of permission-protected APIs, 2) the ad- dition/deletion of dangerous permissions, and 3) the We observed that our studied ARP issues can be classi- changes of associations between APIs and permissions. fied into two general categories: non-library-interfered is- As discussed in SO post #20740632 [17], app devel- sues and library-interfered issues. The former are caused by opers can hardly realize the above changes. What is the mishandling of dangerous permissions in app modules more, there are no official documentations providing while the latter are introduced by inconsistent permission the precise API-DP mappings for each Android version handling between app modules and third-party libraries. and highlighting the changes across versions [30, 31]. These two categories of issues can be further classified into Therefore, if an app uses an API whose permission 11 subcategories according to the root causes of the issues specification has undergone changes, it may crash when (the 11 issue types are disjoint). Figure5 summarizes all invoking such an API on certain incompatible platforms issue types observed by us. To the best of our knowledge, (Type 2 issues). An example is issue #982 [32] in the figure presents by far the most comprehensive catego- Lawnchair. 1 rization of ARP issues. In the following, we discuss each • Evolution of the permission group mechanism. The new type of issues in detail. platforms with API levels 23–25 handle runtime per- mission requests at the group level. On such platforms, 3.2.1 Non-Library-Interfered ARP Issues if a user chooses to grant a permission requested by an app, the rest dangerous permissions in the same group Finding 2: ARP issues can be caused by the evolution of the An- droid platform, in particular, the permission mechanism. It is hard that are declared in the app’s manifest file will also be for developers to track the changes of the permission mechanism granted, without the need of further user interactions. across various Android versions and continuously adapt their apps However, this mechanism has changed since Android to avoid potential ARP issues. 8.0 (API level 26). For apps targeting Android 8.0 or later versions, they are granted only the permissions As discussed earlier, on Android platforms prior to that are explicitly requested at runtime. The other per- Marshmallow (6.0), apps could be granted all requested missions in the same group as the requested permis- sions should still be requested separately. As discussed 1. The APR issues discussed in this section are not specific to dan- gerous permissions. Some may also occur when dealing with normal in SO post #47787577 [33], such evolution complicates permissions. the use of dangerous permissions. Moreover, it can 7

Legacy apps running on new platforms Type 1: Users revoke the permissions that have already been granted at the app’s installation time Issues caused by Android platform New apps running on new platforms evolution Type 2: Apps invoke the APIs whose permission specification has evolved on incompatible platforms Type 3: Apps targeting API levels 23-25 fail to request permissions separately on incompatible platforms

Legacy apps running on new platforms Type 4: Customized platforms may not grant all permissions required by legacy apps and may allow users to revoke granted permissions

New apps running on customized new platforms Non-library-interfered issues Issues caused by device Type 5: Some normal permissions on the original Android platforms turn to manufacturers’ customization dangerous permissions on the customized platforms

New apps running on customized legacy platforms Type 6: Customized legacy platforms may not grant all required permissions to new apps, and permission check APIs always return PERMISSION_GRANTED ARP issues on legacy platforms

Type 7: Incomplete permission check and request process Issues caused by improper permission check and request Type 8: Misusing permission request APIs

Issues caused by conflicting Type 9: Conflicting targetSdkVersion settings in attributes configuration attributes in apps and third-party libraries Type 10: Libraries setting maxSdkVersion in attributes Library-interfered issues Issues caused by incomplete permission check and request in Type 11: Apps may not check and request permissions for libraries third-party libraries

Fig. 5: The taxonomy of our studied ARP issues

cause app crashes if developers do not carefully pro- 26 treat the “Display pop-up window” permission, which gram their apps to request each permission separately is a normal permission on the original Android platform, on Android 8.0 and above (Type 3 issues). An example as a dangerous permission. This problem caused many app is issue #58 [34] in Buglife. crashes and similar cases frequently happened, which was troubling to app developers. Finding 3: Permission-related system customizations made by Scenario 3: New apps running on customized legacy Android device manufacturers may also induce ARP issues. Such platforms. Customized legacy platforms may not grant all issues occur only on specific device models and are difficult to debug. requested permissions to new apps and may allow users Android is an open-source mobile OS. Many mobile to revoke granted permissions. When new apps run on device manufacturers build their products by customizing such platforms, they will check and request for dangerous the original Android platform. The customization may also permissions at runtime. For better compatibility, they may ContextCompat.checkSelfPermission() affect the permission mechanism and cause ARP issues. We use the API pro- observed that such customization-induced ARP issues may vided by the Android support library for permission check. PERMISSION_GRANTED occur in three different scenarios: However, this API always returns on legacy platforms. The new apps then may proceed to in- Scenario 1: Legacy apps running on customized plat- voke permission-protected APIs. As discussed in SO post forms. As discussed in SO post #39654809 [35], customized #43467522 [38], if the required permissions of these APIs Android platforms, either new or legacy, may not grant all are actually not granted or have been revoked, the apps the requested permissions to legacy apps and may allow will crash due to SecurityExceptions (Type 6 issues). An users to revoke granted permissions. If legacy apps cannot example is issue #125 [39] in QRCodeReaderView. obtain the required permissions when running on such cus- tomized platforms, the SecurityExceptions will be thrown Finding 4: Developers may make mistakes in the permission check when the apps invoke permission-protected APIs (Type 4 and request process, causing various ARP issues. issues). Take issue #261 [36] in NEMAndroidApp for example. Developers complained that when the app runs on Oppo R7 As mentioned in Section 2.2, a proper permission check (with Android 4.4.4), the system’s built-in security software and request process involves four steps. We noticed that this would block the requests for dangerous permissions, which is a non-trivial task for many developers and the mistakes led to app crashes. they make could cause two different types of ARP issues: Scenario 2: New apps running on customized new Incomplete permission check and request process. ARP platforms. Due to customization, some normal permissions issues would arise when developers miss certain steps in on the original Android platform may turn into dangerous checking and requesting for dangerous permissions (Type 7 permissions on the customized platforms. This could lead to issues). Specifically, we observed the following cases: app crashes since the majority of apps would not request for • Developers may forget to declare the required dan- such permissions (Type 5 issues). For instance, according to gerous permissions in their app’s manifest file SO post #59418504 [37], some Xiaomi devices with API level (i.e., missing step 1). As discussed in SO post 8

44374646 [40], in such cases, the permission request which the app/library is able to run. Among them, dialog would not pop up after calling the Android the targetSdkVesion attribute is often set to indi- API ActivityCompat.requestPermissions() and the cate the best-fit API level of the app/library. If the permissions cannot be successfully granted. As such, targetSdkVesion attribute declared in an app is in the app would crash when the APIs that require the conflict with that declared in any of the app’s libraries, permissions are invoked at runtime. An example is Android built tool will choose the app’s configuration issue #229 [41] in Dexter. over the library’s to resolve conflicts. As discussed in • Developers may not be fully aware of the permis- SO post 58059097 [51], in such cases, if the library, sion specification of Android APIs and may only de- which is forced to run on an unintended API level, clare the required dangerous permissions in their app’s does not properly check and request for permissions manifest file without really making the app to request before invoking certain APIs (note that these APIs may the permissions at runtime (i.e.,missing steps 2–4). not require permission protection on the library’s target As discussed in SO post 34959331 [42], this will also Android version), there will be runtime exceptions that cause app crashes [42]. An example is issue #1 [43] in can cause app crashes (Type 9 issues). An example is Swati4star. issue #920 [52] in Android-beacon-library. • Developers may also forget to handle users’ response • Libraries’ setting of maxSdkVersion in to permission requests (i.e., missing step 4). In this elements. The scenario, the subsequent operations that require per- elements in the manifest file of an app/library are missions may not be properly performed, according to used to specify the permissions that the user must the SO post 42762308 [44]. An example is issue #737 [45] grant to ensure the app/library to operate correctly. in Native-navigation. For this element, the maxSdkVesion attribute is often • Android documentation suggests that apps should ex- set to indicate the highest API level on which the plain to users why they need certain dangerous per- permission should be granted to the app2. When an missions [46]. As discussed in SO post 30719047 [47], app and its referenced library declare a same dangerous if there is no proper explanation, users may deny the permission in their manifest files but only the library permission requests or even check the option “Never specifies a maxSdkVersion, the final manifest file ask again” on the permission request dialog. Then the merged by the Android build tool will contain the operations that require the permissions may never be dangerous permission with the maxSdkVersion set performed properly. An example is issue #10 [48] in by the library. Then the app cannot request for the Assent. concerned permission on the platforms whose API Misusing permission request APIs. Android provides levels are greater than maxSdkVersion. As discussed a series of APIs to request permissions. We observed that in SO post 54615936 [53], the app will crash in such developers sometimes use wrong APIs for permission re- cases (Type 10 issues). An example is issue #723 [54] in quests, causing ARP issues (Type 8 issues). For example, Mapsforge. as discussed in SO post 35989288 [49], the Activity class (for creating a window) and Fragment class (for creating a Finding 6: Third-party libraries may invoke permission-protected APIs without checking whether the required permissions are portion of a window) define their own permission request granted. If apps using these libraries do not properly check and methods. If an app misuses these methods, such as calling request for the required permissions, ARP issues will arise. the permission request method defined in Activity class from a Fragment, the permissions cannot be granted prop- To access user data or system features, third-party li- erly. An example is issue #228 [50] in OpenRedmine. braries often need to invoke permission-protected APIs. Since libraries typically are not supposed to deal with 3.2.2 Library-Interfered ARP Issues user interactions directly, many library developers would assume that it is the apps’ job to check and request for the Finding 5: ARP issues may arise due to the conflicts between permissions required by libraries. However, as discussed in the configuration attributes in the manifest file of apps and third- SO post 36693127 [55], app developers may not do so and party libraries. this would cause SecurityExceptions (Type 11 issues). As we will show later, such issues are quite common, since For code reuse, Android apps often reference third-party app developers may not be aware of the need to check and libraries. Many libraries contain manifest files to present request for the permissions required by libraries. To avoid essential information to the Android platform. However, such ARP issues, in SO post 39603098 [56], a developer as apps and libraries are typically maintained by different suggested that an app should manage all the dangerous developers, the configuration attributes declared in an app’s permissions it directly or transitively requires, rather than manifest file may have conflicts with those declared in a expecting the libraries to do so. library’s manifest file. In such cases, Android build tool would resolve the conflicts following predefined rules and 3.3 RQ2: Pervasiveness and Seriousness merge multiple manifest files into one [2]. Such merging often causes the following two types of ARP issues. Section 3.2 presents 11 types of ARP issues we observed via studying SO posts and relevant issues on GitHub. In • Conflicting targetSdkVersion settings in elements. The element in the manifest 2. Setting maxSdkVersion is useful if the permission an app requires file of an app/library specifies the API levels on is no longer needed beginning at a certain API level [2]. 9 T3, 5, 3% this section, we further study how pervasive and serious T4, 3, 2% T5, T7.d, 3, 2% 13, 7% these issues are in practice. To answer RQ2, we first refine T2, 48, 24% T7.c, 4, 2%

the keywords to search for more instances of the 11 types T6, 5, 3% of ARP issues on GitHub, and then analyze the yearly T7, 39, 20% distribution and evolution trends of the collected issues. In T1, 20, 10% T7.b, 29, 15% T8, 9, 5% the following, we present our study approach in detail and T11, 24, 12% then discuss our findings. T9, T10, T7.a, 3, 2% 16, 8% 17, 9%

T1-T11 denote Type 1-Type 11 issues T7.a: Missing the declaration step T7.b: Missing the checking, request, and handling users' response steps T7.c: Missing the handling users' response step T7.d: Missing the explanations why the dangerous permissions are needed Keyword formulation. For each type of ARP issues in our taxonomy, we formulated search keywords, as listed Fig. 6: The distribution of ARP issues in Table3, to look for more instances in the 415 collected 3.3.1 The Distribution of ARP Issues GitHub projects. In the table, the symbol “×” denotes Carte- Finding 7: 71% of our collected issues are non-library-interfered is- sian product and “∧” means “and”. The keywords for issues sues while the remaining 29% are library-interfered issues. Among of Types 1, 3, and 7–11 are those terms that frequently occur the library-interfered issues, those that are induced by the evolution in our studied SO posts and relevant issue reports. Issues of of API-DP mappings (Type 2) are the most common. Among the Types 4–6 are caused by device manufacturers’ customiza- library-interfered issues, those that arise after merging conflicting tion of the original Android platform. To search for such manifest files are the most common (Type 11). issues, we included the names of six top Android device Figure6 gives the distribution of the 199 issues. We can manufacturers, which in total have over 80% market share make the following observations from the distribution: according to App Brain [57], in our keywords. Finally, to look for issues of Type 2, we should include the APIs or per- • Among the non-library-interfered issues, 48 (24%) were missions in the evolved API-DP mappings in the keywords. induced by the evolution of API-DP mappings (Type 2). However, as discussed in Section 2.3, there are no readily We conjecture that such issues are the most pervasive available mappings between Android APIs and dangerous because there is no effective mechanism or tool to permissions in the Android documentation [2]. Although help developers adapt their apps to the continually- existing studies (e.g., [1, 18, 58–61]) proposed several tech- changing API-DP mappings. niques to infer such mappings, we found that their released • The second common type of non-library-interfered is- datasets are outdated. To precisely locate issues of Type 2, sues are those caused by the incomplete permission we chose to infer the mappings by ourselves. As pointed check and request process (Type 7). As Figure6 shows, out by Bogdanas [12], starting from Android 6.0 (API level the majority of such issues occurred because the devel- 23), Google formally documents permission specifications in opers did not check and request permissions for certain two ways: 1) using Java annotation @requiresPermission permission-protected APIs. The issues are pervasive, to associate APIs with permissions and 2) using @link probably because there are many permission-protected android.Manifest.permission# to describe an API’s re- APIs on the Android platform. So, it is not easy for quired permissions. Inspired by this observation, we devel- developers to check and request permissions properly oped a tool named APMINER to analyze the Javadoc of the when their apps use such APIs without automated tool Android SDK [62] to infer API-DP mappings.3 We applied support. • APMINER on API levels 23–29 and compared the mined Library-interfered issues are also common, accounting mappings across these API levels. The names of the APIs for 29% of all our collected issues. Among these is- and permissions in the evolved API-DP mappings were then sues, 33 (17%) occurred due to the conflicts between included in our keywords. the configuration attributes in the manifest files of apps and third-party libraries (Types 9–10). Such is- sues frequently occurred because apps and libraries are often maintained separately by different parties. It is hard for developers to be aware of the configurations of all libraries used by their apps. The remaining 24 Issue collecting and filtering. Next, we used the key- issues (12%) occurred because the libraries use certain words to search the issue trackers of the 415 GitHub projects. permission-protected APIs without properly request- We removed the duplicates and noises from the search ing permissions (Type 11). Interestingly, app devel- results and kept those issue reports that satisfy the following opers and library developers seem to have divergent criteria: (1) the reported issue is an instance of our observed opinions on which layer is responsible for requesting types and (2) the report contains sufficient information for permissions: For four out of the 24 issues, the library us to understand the reported issue. With this process, we developers acknowledged that the permissions should obtained a collection of 199 real ARP issues. Note that there be requested in the libraries; However, for the other might be ARP issues that are not included in our taxonomy 3. APMiner is available at http://arp-issues.github.io/. The tool is (i.e., not instances of the 11 types) but we did not observe not a major contribution of this work. We built it for the purpose of such cases in our study. mining the latest API-DP mappings. 10 TABLE 3: The search keywords for each issue type Types Keywords (case insensitive) 1 {“API level”} × {19, 20, 21, 22, 23} × {“runtime permission”} 2 API and permission in evolved API-DP mappings × {“runtime permission”} 3, 7, 8 {manifest, check, request, handle} × {“runtime permission”} 4, 5, 6 {Samsung, Huawei, Xiaomi, Oppo, Motorola, Vivo} × {“runtime permission”} 9, 10 “merge manifest” ∧ “runtime permission” 11 “library” ∧ “runtime permission”

20 of the 24 issues, library developers expected app 10 Type 1 13 Type 7 developers to request permissions instead. 7 9 8 5 2 1 3 0 0 1

2015 2016 2017 2018 2019 2020 2015 2016 2017 2018 2019 2020 3.3.2 The Evolution Trends of ARP Issues

Type 2 17 17 Type 5 9 10

Finding 8: ARP issues caused by third-party libraries (Types 7 9–11), the evolution of API-DP mappings (Type 2), and device 2 2 3 2 0 0 1 manufacturers’ customization of normal permissions (Type 5) are becoming increasingly pervasive in the last five years. In contrast, 2015 2016 2017 2018 2019 2020 2015 2016 2017 2018 2019 2020 issues affecting legacy apps that have not migrated to the runtime permission model (Type 1) and those arising from the incomplete 9 Types 9 and 10 13 Type 11 permission check and request process (Type 7) are diminishing. 12 6 9 4 3 5 2 2 3 Our collected 415 GitHub projects all started before 0 Android adopted the runtime permission model. Observing 2015 2016 2017 2018 2019 2020 this, we further analyzed the yearly distribution of the 199 2015 2016 2017 2018 2019 2020 ARP issues to explore the evolution trends of these issues. Fig. 7: Distribution of ARP issues from 2015 to 2020 We ignored issues of Types 3, 4, 6, and 8 because they only account for a small proportion (less than 5%) in our dataset. Analyzing the evolution trend of these issues might result 3.3.3 Potential Seriousness of ARP Issues in observations that have little statistical significance. Figure7 gives the yearly distribution for issues of Types Finding 9: ARP issues of Types 2, 9, and 10 might be very serious 1, 2, 5, 7, and 9–11. From the figure, we can make the in real-world Android projects. Without automated tool support, following observations: developers can hardly realize such issues.

• Issues of Types 1 and 7 gradually diminish over the As discussed in Section 3.3.2, ARP issues of Types 2, years. These issues occurred because developers did 5, and 9–11 are becoming increasingly pervasive in recent not migrate their apps to the runtime permission model years. To estimate how seriously these issues may affect or did not check and request permissions properly. the Android ecosystem, we performed further analysis, Since the runtime permission model has been used for leveraging larger-scale data. years, it is natural that these issues are fading away and Type 2 issues are caused by the evolution of API-DP becoming less relevant. mappings. To understand the potential seriousness of such • On the other hand, issues of Types 2 and 5 are in- issues, we analyzed the changes of our extracted API-DP creasingly pervasive. These issues occurred due to the mappings (see Section 3.3.1) between different Android ver- evolution of API-DP mappings and Android device sions. As shown in Figure8, there are three types of changes, manufacturers’ customization of normal permissions, including: 1) the addition/deletion of permission-protected respectively. This finding suggests that the evolution APIs, 2) the addition/deletion of dangerous permissions, and customization of Android platforms may affect 3) and the changes in the mapping relations between APIs the compatibility of apps, resulting in serious runtime and permissions. In total, there are over one hundred such permission issues. changes between API levels 23 and 30, which is not a small • The number of library-interfered issues (Types 9–11) number. More surprisingly, we searched on GitHub and continually increases over the years. To understand found 16,492 Android projects that use at least one of the why, we analyzed the build scripts of our collected evolved APIs or declare at least one of the evolved per- open-source apps. We found that the number of li- missions. As an example, we observed that the permission- braries used by these apps on average increased by protected API TelephonyManager.getDeviceId(), which is nearly 35% across the latest ten releases. Such intensive evolved at API level 29, is used by 925 Android projects. uses of third-party libraries have likely induced vari- Since such APIs or permissions are frequently used by a large ous ARP issues, as libraries may interfere with apps’ number of Android projects, ARP issues may easily arise if handling of dangerous permissions. developers do not carefully deal with the evolution of the APIs/permissions. 11

(a) # of changed permission-protected APIs (b) # of changed dangerous permissions (c) # of changed mapping relationships

Fig. 8: The evolution of API-DP mappings across different Android versions (pairwise comparisons)

Issues of Types 9–10 are caused by conflicting configura- TABLE 4: Statistics of fixing strategies tions between apps and third-party libraries. To understand Issue Types T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 how serious these issues can be in practice, we randomly Strategies sampled 3,487 apps, which use Gradle as the build tool, S1 19 5 37 20 on GitHub, and extracted their referenced libraries by ana- S2 46 17 lyzing the build.gradle files. Alarmingly, we found that S3 12 2,946 apps (84.5%) depend on at least one library that S4 4 9 uses inconsistent targetSdkVersions. We also randomly S5 2 3 S6 3 sampled 1,062 Android libraries on GitHub. We were again Each cell reports issue count that are fixed by the corresponding strategy. surprised to find that 316 sampled libraries (29.8%) set maxSdkVersions for their declared dangerous permissions. is non-trivial due to two reasons. First, as discussed in According to libraries.io [63], a website for querying the issue #2110 [65] of K-9, since users may revoke granted dependencies among projects, these 316 libraries are used permissions, developers should make sure that the permis- by approximately 4,130 Android projects. These projects can sion check and request operations are performed at each easily suffer from issues of Types 9/10, if developers do not call site of permission-protected APIs. Second, from devel- carefully resolve the conflicts between the configurations of apps opers’ discussions in issue reports (e.g., issue #76 [66] of and its referenced libraries. QRCodeReaderView), we can tell that if the permission check We did not further analyze issues of Type 5 because they and request operations are performed after the critical task concern customized Android platforms, which are mostly that uses the permission-protected APIs is started, the task closed-source. We did not further analyze Type 11 issues may fail once users deny the permission requests. Therefore, either, as it is known that many Android apps rely on developers should identify appropriate locations in their various libraries, and detecting such issues via analyzing source code for adding such operations to avoid the abortion the complex dependencies is not a trivial task. We will leave of the critical tasks. this to be explored in our future work. Strategy 2: The second common strategy is to check SDK versions before requesting permissions or invoking permission- 3.4 RQ3: Fixing Strategies protected APIs. Developers adopted this strategy to fix 63 To answer RQ3, we first analyzed our collected 199 ARP issues of Types 2 and 9, which are essentially compati- issues and found that: 1) 135 issues have already been fixed bility issues induced by platform evolution. For example, and we can find the corresponding patches, 2) 42 issues Figure9(b) shows the patch for issue #269 [67] (Type 9) are not yet fixed but the developers have described their in device-info. As we can see, the developers revised the fixing solutions in the issue reports, and 3) for the remaining code to make it work on API level 26 and above. 22 issues, we could not find relevant discussion in the Strategy 3: ARP Issues of Type 10 are caused by li- issue reports to understand how the issues can be fixed. braries’ setting of maxSdkVersion in the Therefore, we further analyzed the 177 issues, for which we elements. To fix such issues, developers often chose to could figure out the fixing solutions, to learn the common revise their app’s settings to counteract strategies used by developers to fix ARP issues. the SDK version constraints set by the libraries. We ob- Finding 10: We observed six fixing strategies, four of which can served that 12 issues were fixed in this way. For exam- be used to resolve multiple types of ARP issues. ple, as shown in Figure9(c), when fixing issue #168 [68] in Apptentive-android, developers added the setting Strategy 1: As shown in Table4, nearly half (81/177) tools:node= “replace” when declaring the permission in of our studied ARP issues can be fixed by completing the the app’s manifest file [69].4 permission check and request process. The strategy is effective Strategy 4: Issues of Types 6 and 8 are essentially for fixing issues of Types 1, 3, 7, and 11. Figure9(a) shows a API misuse issues. We found that developers often fix patch that fixes issue #650 [64] (Type 7) in commons-app. As them by revising the usage of permission check or request we can see, developers added permission check and request APIs. In our dataset, 13 issues were fixed in this way. operations before invoking the location-sensing APIs, which Figure9(d) gives the patch of issue #2 [70] (Type 8) in require dangerous permissions. Although the strategy is straightforward, in practice, applying it to fix ARP issues 4. An alternative is to set tools:remove=“attribute” 12

+ if(ContextCompat.checkSelfPermission(ACCESS_FINE_LOCATION)==PERMISSION_GRANTED) { - + // invoke location sensing APIs (critical task) + + } else { + ActivityCompat.requestPermissions(ACCESS_FINE_LOCATION); (c) Fixing strategy 3 + } - ActivityCompat.requestPermissions(getActivity(), permissions, RC_HANDLE_CAMERA_PERM); + ... + @Override + requestPermissions(permissions, RC_HANDLE_CAMERA_PERM); + onRequestPermissionsResult(…) { (d) Fixing strategy 4 + // invoke location sensing APIs if users approve the request… + } + String manufacturer = "xiaomi"; (a) Fixing strategy 1 + if(manufacturer.equalsIgnoreCase(android.os.Build.MANUFACTURER)) { + //show the settings app to allow users to re-grant the revoked permissions + intent.setComponent(new ComponentName("miui.securitycenter", - if((Build.VERSION.SDK_INT >= 23 && checkCallingOrSelfPermission(READ_SMS) "miui.autostart.AutoStartManagementActivity")); == PERMISSION_GRANTED)) + startActivity(intent); + if((Build.VERSION.SDK_INT >= 23 && checkCallingOrSelfPermission(READ_SMS) (e) Fixing strategy 5 == PERMISSION_GRANTED) || + (Build.VERSION.SDK_INT >= 26 && checkCallingOrSelfPermission(READ_PHONE_NUMBERS) - == PERMISSION_GRANTED)) + (b) Fixing strategy 2 (f) Fixing strategy 6

Fig. 9: Example patches of fixing strategies (simplified to ease understanding; the code may not be syntactically correct)

Barcode-Reader. The developers originally used the API 4.1 Study Design and Setup ActivityCompat.requestPermissions() to request per- 4.1.1 Online Survey missions. However, this API is designed for Activity com- ponents instead of Fragments. To fix the issue, developers To learn practitioners’ experiences in dealing with ARP replaced the misused API with another API specifically issues, which cannot be learned via analyzing the data of designed for Fragments. open-source projects, we invited 250 industrial practitioners Strategy 5: Issues of Types 4 and 5 can only occur on to participate in an online survey. These invited participants work for IT companies of different scales, including Ten- certain Android device models. To fix such device-specific 5 6 7 8 9 10 issues, developers often check device information (e.g., the cent , ByteDance , Baidu , Meituan , Sogou , Kuaishou , and a manufacturer) before using permission-protected APIs. As an startup company (the name is anonymized for business con- example, Figure9(e) gives a patch of issue #766 [71] in cerns). Most of the companies are well-known globally. In Katzer. The purpose of the patch is to adapt the app to work particular, Tencent and ByteDance are leading IT companies on Xiaomi devices with legacy platforms, which allow users in China, whose representative app products are WeChat to revoke permissions. As we can see, to avoid app crashes and Tik Tok, which have attracted billions of users. caused by invoking APIs whose required permissions are (1) Questionnaire Design revoked by users, the revised code launches the system set- tings app to ask users to re-grant the revoked permissions. Our questionnaire consists of two parts: (1) questions to Strategy 6: Besides Strategy 3, we found that some collect practitioners’ background information and (2) ques- coordinat- tions to learn practitioners’ experiences in handling Android developers also fixed issues of Type 10 by 11 ing with library developers to remove the SDK version con- runtime permissions. straints on dangerous permissions. For example, the library The questions in the first part include: Hockey-SDK-Android [72] set maxSdkVersion for the per- • Q1: How long have you been developing Android applica- mission WRITE_EXTERNAL_STORAGE in its manifest file, which tions? caused ARP issues in three apps [73–75]. We observed 0-1 year / 1-3 years / 3-5 years / over 5 years; that the app developers requested the library developers • Q2: During Android app development, have you dealt with to remove the maxSdkVersion setting to avoid its impact on runtime permissions? client apps. The pull request [76] for addressing this issue, Yes / No. which is shown in Figure9(f), was merged by the library Q1–Q2 help to filter respondents (i.e., the survey pro- developers. ceeds only when the respondents have experiences of deal- ing with runtime permissions) and allow us to analyze the responses of participants with different experience levels. 4 FIELD SURVEYAND INTERVIEW The questions in the second part include: The empirical study in Section3 focused on data from • Q3: Do you deal with the cases where users revoke certain open-source projects. To explore RQ4–RQ5 and deepen our permissions? understanding of ARP issues, we also performed an on- Carefully dealing with all such cases / Dealing with line survey and interviews among Android practitioners. some of such cases / Not dealing with such user Specifically, to answer RQ4, we designed a questionnaire interaction scenarios; based on the knowledge gained from the empirical study and invited 250 Android practitioners from seven represen- 5. https://www.tencent.com/en-us/ tative IT companies to participate in the survey. To answer 6. https://www.bytedance.com/en/ RQ5, we interviewed six experienced Android practitioners 7. https://home.baidu.com/ 8. https://www.meituan.com/ with different backgrounds, which allowed us to further 9. https://www.sogou.com/ understand ARP issues from different perspectives. In the 10. https://www.kuaishou.com/ following, we present our study design and major findings. 11. Our questionnaire is at: https://forms.gle/xTaJ7AtpUp5rcSWUA 13 TABLE 5: Basic information of our interviewees Practitioner Company Position & Work Experience Product & Downloads Android Development Leader Tik Toka P1 ByteDance 6 years Android app development 1,000,000,000+ downloads Android Engineer/Android Tester Tik Toka P2 ByteDance 5 years Android app development & 2 years Android app testing 1,000,000,000+ downloads Android Engineer Meituan dianpingb P3 Meituan 5 years Android app development 1,000,000+ downloads Android Engineer Kwaic P4 Kuaishou 6 years Android app development 100,000,000+ downloads Android Engineer Sogou PinYind P5 Sogou 8 years Android app development 10,000,000+ downloads Android Engineer/Android Tester - P6 A startup 4 years Android app development & Android app testing - a. https://play.google.com/store/apps/details?id=com.zhiliaoapp.musically; b. https://play.google.com/store/apps/details?id=com.sankuai.meituan; c. https://play.google.com/store/apps/details?id=kwai.video.community; d. https://play.google.com/store/apps/details?id=com.sohu.inputmethod.sogou

• Q4: How do you determine which permissions are required for an API? 9% 17% Checking official Android documentation / Checking Tencent 12% ByteDance Java annotations in the source code of Android SDK / 7% Baidu Searching technical forums such as SO / Based on my 26% Meituan Sogou own development experiences / Other (fillable); 23% Kuaishou • Q5: Are you used to follow the changes in runtime per- 6% mission mechanisms when a new version of Android OS is released? (a) Number of respondents from Yes / No; each IT company • Q6: Do you consider the customization of the vanilla An- 1% 6% droid OS made by mobile device manufacturers when han- 6% 0-1 year 16% dling runtime permissions? 40% 28% 1-3 years Yes / No; 3-5 years • Q7: Do you examine the use of APIs for checking and Over 5 years 26% 77% requesting permissions? Checking all such API uses / Checking some of such API uses / Not checking such API uses; (b) 121 respondents’ work experience (c) 70 respondents’ work experience • Q8: Do you use third-party libraries (e.g., PERMISSIONS- in valid responses in invalid responses DISPATCHER12) that help handle runtime permissions, dur- Fig. 10: Demographics of participants in our survey ing the development process? Yes / No; effectily learn real practices that may cause or prevent ARP • Q9: If your Android app uses third-party libraries, do you issues, which may provide insights for future research on realize how the libraries deal with runtime permissions? ARP issue diagnosis. We additionally designed Q11 and Yes / No; Q12 to learn practitioners’ opinions and requirements of • Q10: Do you realize the impacts on the runtime permission tools to combat ARP issues. In the end of the questionare, we handling logics brought by introducing third-party libraries also asked the participants to leave their contact information into your Android app? if they were available for an interview to further discuss the Yes / No; problems of Android runtime permissions. • Q11: Do you use any tools to help check whether your (2) Survey Participants Android apps handle runtime permissions properly? Yes / I Know about such tools but I have never used In total, we received 191 responses from practitioners any of them / I have never used such tools and know working in seven IT companies. Figure 10(a) presents the little about them; demographic information of the participants. 121 out of 191 • Q12: Do you think a tool that helps check whether Android respondents (63.4%) have experiences of dealing with run- apps properly handle runtime permissions would be useful? time permissions and their responses are considered valid. Very useful / Useful / Maybe useful / Useless. Figure 10(b) and (c) show the experiences of the respondents Q3-Q10 were formulated based on our empirical find- providing valid and invalid responses, respectively. Among ings in Section3. Specifically, these questions focus on the the 70 respondents without prior experiences of handling factors that can induce ARP issues. Combining the re- runtime permissions, 77% have 0-1 year of Android app sponses from participants with the root causes of different development experience. Comparatively, most of the 121 ARP issues summarized in the previous study, we can respondents with experiences of handling runtime permis- sions are experienced Android app developers (3–5 years). As such, further analysis of survey results was performed 12. PERMISSIONSDISPATCHER is a third-party that provides a simple annotation-based API to handle runtime permissions on the 121 valid responses. We will present our findings in (https://github.com/permissions-dispatcher/PermissionsDispatcher). Section 4.2. 14

4.1.2 Practitioner Interviews cause Type 1 issues; Q4 and Q5 are related to issues of To understand the common challenges faced by practition- Types 2 and 3; Q6 mentions the cause of issues of Types ers when they encounter ARP issues, we further conducted 4, 5 and 6; Q7 and Q8 are related to issues of Types 7 and audio interviews with the survey respondents. 8; the factors described in Q9 and Q10 can induce issues of Types 9, 10 and 11. The purpose of asking them is to (1) Interviewees learn industrial practices on permission handling, which Fifteen participants of our online survey left their contact may cause or help prevent ARP issues. Now we analyze information and volunteered to participate in our inter- the practitioners’ responses and present our findings. views. Since interviews are time-consuming, we invited six Finding 11: A large percentage of real-world practitioners have not of these volunteers for the audio interviews. Table5 pro- considered all situations where users revoke granted permissions. vides the information of the six interviewees. As we can see from the table, our interviewees are experienced in Android From the responses to Q3, 38.6% practitioners deal with app development: all of them have at least four years of permission revocation cases partially, and 6.8% practitioners experience. They also have different positions in companies are not aware of such abnormal user interactions. Such of different scales. P1 is an Android development leader omission in handling permissions can easily cause runtime working on Tik Tok (from ByteDance, a leading IT company exceptions, especially when legacy apps run on new plat- in China), which is one of the most popular short video forms, as we have discussed in Section3. social app all over the world. P2 is P1’s colleague, who is a senior Android engineer having fives years of development Finding 12: Practitioners have different ways of determining API- experience and two years of testing experience. In particular, DP mappings for handling runtime permissions. Many of them also pay attention to the evolution of the runtime permission P1 and P2 are responsible for runtime permissions-related mechanism. matters; P3, P4 and P5 are senior Android engineers from Meituan, Kuaishou, and Sogou, respectively, and participated For Q4 and Q5, we found that practitioners may deter- in the development of globally well-known app products mine API-DP mappings in many ways, including checking Meituan dianping, Kwai and Sogou , respectively. P6 is the official Android documentation (80.7%), checking Java responsible for both app development and testing in a small annotations in the source code of Android SDK (53.4%), startup company. searching technical forums such as SO (42%), and relying on their own development experiences (47.7%). 86.8% of (2) Interview Design respondents concern the changes in the runtime permission We conducted semi-structured interviews with the six mechanism when a new version of Android OS is released. practitioners. The interviews have three parts and contain These results suggest that many practitioners have realized a general question designed based on RQ5 and a series of that the evolution of API-DP mappings and the runtime per- open-ended questions. Specifically, our question in the first mission mechanism can induce ARP issues. However, thor- part was phrased as “What challenges have you encountered oughly checking such evolution and validating its impact when dealing with ARP issues and what solutions have you on dealing with runtime permissions are non-trivial tasks adopted to solve the problems?” The aim of this question was for practitioners. We have witnessed many real ARP issues to initiate the discussion, allowing the interviewees to freely of Types 2 and 3 in open-source projects (see Section 3.2.1). share their experience without focusing on any specific type of ARP issues. In the second part of the interview, we impro- Finding 13: Many practitioners do not realize the impact of mo- vised questions based on the interviewees’ answers to our bile device manufacturers’ customization and third-party libraries’ configurations on Android apps’ handling of runtime permissions. first question. For instance, we asked the scenarios or root causes of their encountered ARP issues and then, if they pro- From the answers to Q6, we can see that although many vided clear description, we proceeded with more detailed Android device manufacturers make various permission- questions to further understand the related challenges. In related system customization, which can easily induce ARP the third part, we asked the interviewees’ requirements and issues of Types 4, 5 and 6, 32.2% of the surveyed practi- expected features for a tool that can help them deal with tioners do not realize such customization on specific device ARP issues, so as to inspire the future research. models. Similarly, as we can see from the answers to Q9 The length of interviews varied between 24 and 43 and Q10, although many practitioners might have realized minutes, with an average of 32 minutes. We sought the that ARP issues can be caused by inconsistent permission interviewees’ consent to make audio recording of all the 13 handling between app modules and third-party libraries interviews for subsequent analysis. We will discuss our (issues of Types 9, 10 and 11), there are still 40.9% re- findings in Section 4.3. spondents not realizing how third-party libraries deal with runtime permissions, and there are 25% respondents paying 4.2 RQ4: Industrial Practices no attention to the impacts on runtime permission handling logics brought by third-party libraries. Figure 11 gives the distribution of practitioners’ responses to our questionnaire. As previously described, questions Finding 14: Tools that can help manage runtime permissions or Q3–Q10 were formulated based on the root causes of our detect improper handling of runtime permissions can be very useful observed ARP issues: the scenario mentioned in Q3 may to practitioners.

13. The recordings are available at http://arp-issues.github.io/. The answers to Q7 and Q8 show that only 52.9% prac- 15

Q3: Do you deal with the cases where users revoke certain Q8: Do you use third-party libraries that help handle permissions? runtime permissions, during the development process?

Dealing with all such cases Yes Dealing with some of such cases No

Not dealing with such user interaction scenarios

Q9: If your Android app uses third-party libraries, do you Q4: How do you determine which permissions are required realize how the libraries deal with runtime permissions? for an API?

Checking official Android documentation Yes Checking Java annotations in the source code of Android SDK No Searching technical forums

Based on my own development experiences Q10: Do you realize the impacts on the runtime permission handling logics brought by introducing third-party Other libraries into your Android app?

Q5: Are you used to follow the changes in runtime Yes permission mechanisms, when a new version of Android OS is released? No

Yes No Q11: Do you use any tools to help check whether your Android apps handle runtime permissions properly?

Q6: Do you consider the customization of the vanilla Yes Android OS made by mobile device manufacturers when handling runtime permissions? Knowing about such tools but having never used any of them Having never used such tools and knowing little about them Yes No Q12: Do you think a tool that helps check whether Android apps properly handle runtime permissions would Q7: Do you examine the use of APIs for checking and be useful? requesting permissions? Very useful Checking all such API uses Useful Checking some of such API uses Maybe useful Not checking such API uses Useless Fig. 11: Practitioners’ responses to our questionnaire titioners carefully examine the uses of APIs for checking In our interviews, the participants shared with us the and requesting permissions, possibly because the process problems they met when dealing with Android runtime is troublesome. The missing examination of such API uses permissions and how they solved the problems. In the may induce ARP issues of Type 7 (i.e., incomplete permis- following, we discuss their viewpoints from four aspects: sion check and request process) and 8 (misusing permission • Android platform evolution. P2, P3, and P5 stated request APIs). To avoid making mistakes in runtime permis- that they have encountered ARP issues introduced sion handling, 52.3% of our surveyed practitioners adopt by the evolution of API-DP mappings and the per- third-party tools to help deal with runtime permissions. In mission group mechanism. Both P3 and P5 said that addition to tools that help manage runtime permissions, the they would pay special attention to permission-related majority (69.8)% of respondents are also interested in tools information in the release notes of Android SDK, es- that can help detect ARP issues, as we can tell from their pecially for the cases of “permission contractions”. P3 answers to Q12. Two survey participants even left com- shared a “permission contraction” case: “At API level ments, saying that their companies have developed such 28, one of their APIs required the READ_PHONE_STATE tools for internal use. However, according to the answers to permission, which can be requested at runtime from Q11, 67% of the practitioners know little about such tools. users. During the evolution, this API turned to require These results show that there is a real need of automated the READ_PRIVILEGE_PHONE_STATE permission. How- techniques to help developers effectively manage runtime ever, READ_PRIVILEGE_PHONE_STATE is a system permis- permissions and combat ARP issues. Future research may sion and could not be granted to apps since API level focus on developing such techniques and make them avail- 29.” As such, to solve the ARP issue, they adapted the able to real-world Android practitioners. permission request on different versions of Android platforms. P2 emphasized: “We would not upgrade the apps’ targetSdkVersion until the new features of upgraded 4.3 RQ5: Challenges Faced by Practitioners Android SDK version have been adequately tested by our testing group, to avoid ARP and other incompatibility is- Finding 15: Due to the differences in production functionalities, sues.” On the other hand, P1, P4, and P6 said that business requirements, and testing schemes, industrial practitioners faced different challenges when dealing with runtime permissions. they rarely encountered such types of issues, since their products only involve few common dangerous permis- 16

sions, such as Camera, Location, Storage, etc., and in the app modules are developed based on open-source their apps, the dangerous permissions are required by libraries. As a good practice, in the entry methods a set of stable APIs. that directly invoke the third-party library APIs, they • Device manufacturers’ customization. P1, P3, P4, and encapsulated the permission processing operations, to P5 complained that they have seen lots of ARP issues ease the code evolution or library substitution in the caused by customized platforms. They encountered future. In his view, library developers should clearly two main challenges when dealing with such issues: document the need of requesting dangerous permissions in (1) before the runtime permission model was intro- client apps, if the request should not be performed in the duced into vanilla Android OS, several device manu- layer of libraries. Besides, he also appealed to library facturers (e.g., Huawei and Xiaomi) had already imple- developers to refrain from setting SDK version constraints mented their own runtime permission mechanism into on dangerous permissions to avoid affecting client apps. mainstream products; (2) different device models cus- P6’s ideas can help proactively prevent ARP issues of tomized the runtime permission mechanism in different Types 9, 10, and 11. ways, and it is difficult to deal with the varieties in Android apps. As a development leader in an leading Finding 16: Practitioners have various requirements for tools that IT company, P1 stated “Our testing group would verify can detect ARP issues. apps’ permission requests on various mainstream devices Interviewees’ experiences are complementary to our em- to identify the affects induced by their customizations. De- pirical findings observed via analyzing the data from the velopment group would then add checking statements for open-source community. Besides the experience sharing, device models and perform the adaptions accordingly.” These they also expressed their requirements for tools that can experiences are inline with our empirical findings via help detect ARP issues: (1) the tool should construct a investigating data from the open-source community. testing framework to analyze how their apps’ permission The expert’s sharing can also provide implications for requests behave on different device models and Android future research to develop automated techniques to versions (from P1, P2, P3, P4, and P5); (2) the tool should combat ARP issues of Types 4, 5, and 6. simulate various permission-control behaviors of users (e.g., • Improper permission check and request. Both P2 and denying the permission requests) and analyze how the P6 considered improper permission check and request apps would behave in such scenarios (from P2 and P6); (3) as their major challenges when dealing with runtime the tool should identify all the permission-protected APIs, permissions. They stated that in the diversified and especially in the third-party libraries and analyze whether complicated permission handling scenarios, the cases the permission check and request operations have been of missing check and request steps for runtime per- properly performed (from P2 and P6); (4) the tool should missions frequently occurred. In particular, P2 stated analyze libraries’ permission configurations and validate “To avoid such negligence, we should clearly know which whether their permission check and request operations be- Android APIs are protected by permissions and carefully have properly after being integrated into the apps (from P6). program our apps to request permissions at runtime and han- We believe that the above analyses of the interview results dle various user actions.” P6 stated that as their products along with our issue taxonomy can guide future research to become mature, they adopted third-party tools such as design automated tools to help Android developers combat PERMISSIONSDISPATCHER to simplify the permission ARP issues. check and request process. These tools alleviated their burden of writing a bunch of check and request state- ments and are helpful in keeping the source code clean 5 RQ6: PERFORMANCEOF EXISTING ARPISSUE and safe. As such, in P6’s company, there are fewer ARP DETECTORS issues in recent two years. • Interference by third-party libraries. From the feed- As we mentioned ealier, in recent years, there have been back of interviewees, we found that the degree of several tools designed to detect ARP issues in Android the interference by third-party libraries in terms of apps. With the 11 types of common ARP issues identified ARP issues may be highly correlated with the adopted in our previous study, we are intrigued to know how these open-source libraries and the manpower companies tools would perform in practice. Toward this end, we built invested in app testing. P1 and P2 stated that they a benchmark consisting of 94 real ARP issues and used it rarely encountered library-interfered issues, since most to study the performance of three publicly accessible ARP of their integrated libraries are closed-source, which issue detectors. We report this study in the following. are customized for their apps and have been thor- oughly tested. P3, P4, and P5 said that they occasionally 5.1 Study Design and Setup experienced ARP issues introduced by third-party li- braries. In their companies, only a subset of libraries are ARP issue detectors. To address RQ6, we selected the latest adopted from open-source community. P3 emphasized version of three existing tools for empirical evaluation and “We should pay special attention to the permission config- comparison: urations in third-party libraries to prevent our apps from • LINT [77], a static analyzer that scans the source files of inheriting improper configurations.” Comparatively, P6 Android projects to find common bugs, including ARP stated that they often encountered such issues, because issues. As it is integrated in Android Studio, Lint has in their company, which is a small startup, most of been widely-used by developers [78]. 17 TABLE 6: The performance of existing ARP issue detectors

# Detected issues # False alarms Tools Type 1 Type 2 Type 3 Type 7 Type 8 Type 9 Type 10 Type 11 (Issue Detection Rate) (False Alarm Rate) LINT 0/9 0/22 2/5 11/18 0/4 0/11 0/10 7/15 20 (21.3% = 20/94) 11 (55.0% = 11/20) ARPDROID 6/9 0/22 1/5 8/18 0/4 0/11 0/10 - 15 (19.0% = 15/79) 15 (100.0% = 15/15) REVDROID 6/9 0/22 2/5 9/18 0/4 0/11 0/10 - 17 (21.5% = 17/79) 17 (100.0% = 17/17)

For each selected issue in our benchmark, if the detector t reports a warning that describes an ARP issue at the con- cerned issue location of the buggy app version, we consider this warning as a true one, i.e., the detector t successfully detects the ARP issue. Otherwise, we consider that the tool misses the ARP issue. After evaluating t with all applicable ARP issues, t’s issue detection rate can be calculated by Fig. 12: Distribution of each type of selected ARP issues in the Equation (1). Furthermore, we leveraged the patched app ARPBENCH versions to evaluate the false alarm rate of each detector t, denoted as F AR(t). For each issue that is detected by • ARPDROID [11], a technique to detect and fix compat- the detector t, if t still reports a warning after analyzing ibility issues related to runtime permissions by analyz- the patched app version, we consider this warning as a apk ing the file of an Android app. false alarm. Similarly, after evaluating t with all applicable • REVDROID [13], a tool to identify ARP issues that arise patched versions, t’s false alarm rate can be calculated by apk when users revoke permissions by analyzing the Equation (2). Note that during the experiments, we would file or an Android app. ignore the warnings that are not related to our selected ARP Benchmark. For the experiments, we also need a bench- issues, due to the lack of reliable ground truth to judge mark of ARP issues. As there is no readily available bench- whether the warnings are true ones or not. mark, we selected a subset of the real ARP issues collected in our empirical study (Section 3.3) and constructed a bench- #ARP issues detected by t on buggy app versions IDR(t) = (1) mark, named ARPBENCH, by ourselves. We did not use #Buggy ARP issues experimented on t all ARP issues from our empirical study dataset due to three major reasons. First, for each ARP issue, we need both #false alarms reported by t on patched app versions F AR(t) = (2) buggy and patched app versions to evaluate the three tools’ #Patched ARP issues experimented on t performance. Some issues investigated in our empirical study have not been fixed by developers yet and hence they 5.2 Experiment Results are not suitable for the tool evaluation. Second, compiling open-source Android apps is a cumbersome process. Many Table6 reports the experiment results of the three ARP issue open-source apps rely on specific libraries, which can be detectors. We discuss the main findings below. hard to find. What is more, open-source apps do not always Finding 17: The three detectors are weak in detecting the 11 have build scripts or clear compilation instructions. Third, common types of ARP issues. In particular, none of the detectors for the ARP issues caused by manufacturers’ customization, can detect ARP issues of Types 2, 4–6, and 8–10, which are caused we could not figure out the exact device models on which by the evolution of API-DP mappings, device manufacturers’ cus- the issues would occur. Besides, to the best of our knowl- tomization, and interference of third-party libraries. edge, there are no existing detectors for such device-specific issues. Therefore, we ignored these issues (Types 4–6). With We observed that the tools’ poor performance in terms the above constraints and considerations, we finally selected of issue detection rate is due to their following limitations: 94 ARP issues from the 199 issues collected in Section 3.3 to • Not aware of the effects caused by Android platform evolu- construct ARPBENCH. Figure 12 shows the distribution of tion. The three detectors do not take the evolution of the ARP issues in ARPBENCH. It is worth noting that all API-DP mappings across different Android platforms of our collected Type 11 issues (i.e., library-interfered ARP into consideration when detecting ARP issues. As such, issues) are reported in the third-party libraries’ issue track- they missed the issues of Types 2 and 9. ers. We could not find the corresponding apps that suffered • Not aware of the effects caused by conflicting configurations from the ARP issues and therefore could not prepare apk between apps and their referenced libraries. None of the files to evaluate ARPDROID and REVDROID. The 15 issues three evaluated detectors could identify the conflict- of Type 11 were only used to evaluate LINT, which directly ing configurations between apps and their referenced analyzes source code for issue detection. libraries on runtime permissions and analyze the effects Metrics. Following a recent study that evaluates resource of such conflicts. Due to this reason, the detectors leak detectors for Android apps [79], we evaluated the issue missed Type 10 issues. detection rate and false alarm rate of the three detectors, which • Not aware of the misuse of permission request APIs.LINT are defined in Equations (1) and (2), respectively. Specif- and REVDROID only check the uses of permission check ically, we leveraged the buggy app versions to evaluate APIs and ignore permission request APIs. Even worse, the issue detection rate of a detector t, denoted as IDR(t). ARPDROID performs coarse-grained analysis and do 18

son for such a high false alarm rate (55.0%) is that LINT per- forms intra-procedural analysis [80] and can only identify the lack of permission check APIs within the method that calls permission-protected APIs. If the calls of permission check APIs are located in other methods on the callchain, LINT will generate false alarms. For instance, Figure 13 shows a case extracted from the patched app version cor- responding to issue #90 of stardroid [81]. In this case, Fig. 13: A call chain from the patched app version correspond- LINT checks whether there is a permission check API in ing to issue #90 of stardroid to illustrate LINT’s limitation the method LocationController.start(), where the two not check the correctness of the uses of both permission permission-protected APIs are called. The developers have check and request APIs. As a result, they do not support correctly inserted the calls to permission check and request detecting Type 8 issues. APIs into the method checkLocationServicesEnabled() • Not aware of the effects caused by platform customizations. in class GooglePlayServicesChecker, which would be exe- Despite the lack of Types 4–6 issues for experiments, to cuted before LocationController.start(). However, since the best of our knowledge, the three detectors are not LINT does not perform inter-procedual analysis on such a capable of detecting the ARP issues caused by various call chain, it cannot infer the existence of permission check customizations made by device manufacturers. and request steps, and would then report a false alarm. • No support for legacy apps. Lastly, by further analyzing For the 15 issues reported by ARPDROID, we also ap- the ARPBENCH and LINT’s source code, we found that plied the tool to analyze the patch versions. Suprisingly, LINT did not check ARP issues of Type 1 for legacy ARPDROID still identified the lack of permission check and apps. This is also a limitation of LINT. request steps, and inserted the correponding API calls at the call sites of permission-protected APIs, regardless of the Finding 18: Although existing detectors can detect issues caused existence of such API calls in the source code of the patched by incomplete permission check and request (Types 1, 3, 7, and 11), verions. The false alarm rate is 100.0%. they could still miss many real issues in ARPBENCH. Similar to ARPDROID, REVDROID still reported The three detectors missed some issues of Types 1, 3, 7, warnings for all the 17 patched versions. Although and 11 in ARPBENCH because of the following two reasons: REVDROID carefully checks whether there are permission check APIs on the call chains that reach • Outdated or incomplete API-DP mappings.ARPDROID the call sites of permission-protected APIs, it only and REVDROID detect ARP issues based on the API- check the existence of calls to the following APIs: DP mappings obtained by PSCOUT [58] (i.e., a study checkPermission(), checkCallingOrSelfPermission(), on permission specifications). However, PSCOUT only checkCallingPermission(), and checkUidPermission(). produced the permission specifications for Android Since Android 6.0, these APIs have been replaced by 4.1.1–5.1.1, which are outdated. Besides, as mentioned checkSelfPermission(). Since REVDROID is not aware in Section 3.3.1, since Android 6.0 (API level 23), Google of the permission check operations performed using started to document permission specifications in two checkSelfPermission(), it reported many false alarms. ways: 1) using Java annotation @requiresPermission Suggestions for future ARP issue detector designers. to associate APIs with permissions and 2) using @link The existing detectors have very limited support for detect- android.Manifest.permission# to describe an API’s ing real-world ARP issues. An effective ARP issue detection required permissions. By analyzing the source code of technique should address the following four challenges: LINT, we found that it collects the API-DP mappings only by analyzing the Java annotations in the source • It should be able to deal with diverse types of APR code of Android SDK. As such, its API-DP mappings issues with different root causes. are not complete. • It should be powered by complete and precise API- • Not sensitive to all the steps of permission check and request DP mappings. The evolution of Android platform and process.ARPDROID does not support detecting issues the customizations performed by device manufacturers caused by the lack of Step 4. Besides, according to the should also be taken into consideration. research paper [13] and our analysis of LINT’s source • It should be able to analyze the conflicts of configura- code, REVDROID and LINT can only identify ARP issues tion attributes in manifest files between an app and its caused by the lack of Step 2 during the permission check referenced libraries to detect library-interfered issues. and request process. As a result, the three detectors • It should be able to identify the permission-protected missed some of Types 1, 3, 7, and 11 issues. APIs and their invocation paths in both app mod- ules and libraries. In particular, the path identification Finding 19: For the ARP issues caused by incomplete permission should be performed both intra-procedurally and inter- check and request or misusing permission request APIs (Types 1, procedurally to avoid false alarms or false negatives. 3, 7, and 11), the three detectors all report a large number of false alarms. The false alarm rate can be as high as 100.0%. 6 THREATS TO VALIDITY For the 20 ARP issues captured by LINT, we applied LINT to analyze the patched versions and found that LINT The validity of our study results may be subject to the still reported 11 warnings, which are false alarms. The rea- following threats. 19

ARP issue collection. Our collected ARP issues may our work systematically investigates the types, root causes, not be representative and comprehensive. To mitigate this pervasiveness and seriousness, as well as fixing strategies of threat, we followed a rigorous process to collect issues. First, the issues related to runtime permissions. we studied all SO posts tagged with “runtime permission” User interactions with runtime permission model. Re- or containing the general phrase “Android runtime permis- searchers have proposed different extensions to runtime sion” to study all relevant issues discussed on SO. Based permission models to provide users with more control and on the study results, we then formulated a set of keywords better management [94–100]. Andriotis et al. [3] presented (Table3) to search for ARP issues in open-source Android the first study that analyzed Android users’ adaptation to projects. The 415 open-source projects were carefully se- the fine-grained runtime permission model, regarding their lected to ensure their diversity and impact (we considered security and privacy controls. Considering the accessibility the downloads of the apps, the projects’ star and fork counts of particular apps to resources, the authors highlighted the on GitHub). In the end, we collected 199 real ARP issues. We persistence of users to allow access to permissions that are believe that this dataset is of good quality. We release it for directly related to their main functionalities. To improve public scrutiny. the users’ understanding of the purposes of requesting Trend analysis. The number of issues used in the evolu- permissions, Liu et al. [101] conducted a large-scale study tion trend analysis (Section 3.3.2) is limited. To avoid making on five aspects of runtime-permission rationale messages. observations that have little statistical significance, we have They found that less than one-fourth of apps provided already excluded four types of issues with few instances. such rationales, which indicated that developers might need Future studies can further validate our findings in this trend further guidance on how to explain the purposes of re- analysis, when there are larger-scale datasets. questing permissions. Shen et al. [102] first investigated API-DP mappings. We mined API-DP mappings from to what extent current system-provided information could the Javadoc of Android SDK for API levels 23–29 (as help users understand the scope of permissions and their mentioned earlier, we had to do this by ourselves because potential risks. They took a mixed-methods approach by col- existing datasets are outdated). If the official documentation lecting real permission settings from 4,636 Android users, an is not complete, we will miss some mappings. In future, we interview study of 20 participants, and large-scale Internet will further improve the mining approach and explore more surveys of 1559 users. Their study identified several com- complete API-DP mappings. mon misunderstandings on the runtime permission model Errors in manual inspection. Our study involved much among users. Our work considered such user interactions manual work (e.g., analyzing SO posts and issue reports). in adverse conditions as an important type of triggering We understand that such a manual process is subject to conditions of ARP issues, which provided implications for errors. To reduce the threat, we have cross-validated all designing an effective testing technique. results for consistency. Inferring API-permission mappings. Several ap- Incompleteness of the issue taxonomy. In our study, proaches [6, 18, 30, 31, 58–61] were proposed to infer the the taxonomy of ARP issues is obtained by analyzing the mappings between permissions and Android APIs via per- collected posts on SO. Although SO is one of the most forming static analysis on Android framework. Felt et al. [1] popular Q&A sites for developers, it may not contain the proposed a technique Stowaway to construct permission discussions of all possible types of ARP issues. Despite that specification, which used test generation to exercise An- we have verified that our taxonomy could covered all the droid APIs, and modified the internal permission check real ARP issues collected from GitHub when investigating mechanism to log all permission checks on Android 2.2. RQ2, future studies may further improve the taxonomy. However, Stowaway only analyzed Android 2.2. Their ob- tained permission specification was precise but incomplete. 7 RELATED WORK PSCOUT [58] produced a large permission specification for Existing studies [3, 58, 59, 61, 82–101] have investigated Android 4.1.1–5.1.1, but its results are imprecise because many aspects of Android permission system. We discuss its static analysis is coarse-grained. COPES [59] was pro- those that are most relevant to our work below. posed by Bartel et al. to discover over-privileged apps. It Migration to the runtime permission model. Since the also produced a permission specification using reachability release of Android 6.0, researchers have proposed several analysis on Android framework. Later in [60], Bartel et al. techniques to help legacy apps automatically migrate to the proposed an advanced class-hierarchy and field-sensitive runtime permission model. For instance, Dilhara et al. [11] analysis to extract the mappings between Android APIs and presented ARPDROID, a technique to check and enforce the their required permissions. They conducted the experiments app’s conformance to the runtime permission use protocol on a large set of apps to detect permission gap issues (for based on control flow analysis. Bogdaˇnas [12] presented Android 2.2), i.e., there are more permissions than necessary. DPERM, a static analysis technique to recommend code Nguyen et al. [61] presented an approach to identifying locations to insert permission requests into Android apps. Android APIs that access sensitive system or user data. They Fang et al. [13] designed a tool REVDROID, to identify analyzed six versions of Android (4.1.1–6.0.1) and detected the issues that arise when permission checks are far away the APIs that may be sufficiently protected by permission from where the permissions are used. These issues can lead checks. AXPLORER [18] was built on top of PSCOUT through to crashes when permissions are revoked by users while more precise modeling of Android internals. Yet, it con- permission-protected functions are executing. However, the tained few mappings for dangerous permissions. Besides, above techniques only focus on specific types of APR is- Bao et al. [6] proposed two approaches to recommending sues. For a comprehensive understanding of ARP issues, permissions required by APIs used in Android apps, via 20 data mining and collaborative filtering techniques. Com- [4] Y. Feng, L. Chen, A. Zheng, C. Gao, and Z. Zheng, “Ac-net: As- pared with the above work, our work has a wider focus. sessing the consistency of description and permission in android apps,” IEEE Access, vol. 7, pp. 57 829–57 842, 2019. In addition to issues caused by the evolution of APIs and [5] E. Alepis and C. Patsakis, “Hey doc, is this normal?: exploring dangerous permissions, we also study many other types of android permissions in the post marshmallow era,” in Interna- ARP issues. tional Conference on Security, Privacy, and Applied Cryptography Evolution of permission mechanism. There are also a Engineering. Springer, 2017, pp. 53–73. [6] L. Bao, D. Lo, X. Xia, and S. Li, “Automated android application few studies that investigate Android’s permission mech- permission recommendation,” Science China Information Sciences, anism and its evolution. Wei et al. [85] studied a set of vol. 60, no. 9, p. 092110, 2017. Android releases to investigate the evolution of the Android [7] “Post #34150083,” https://stackoverflow.com/questions/ ecosystem to understand whether the permission model is 34150083/when-to-request-permission-at-runtime-for-android- marshmallow-6-0/34181668#34181668, 2021, accessed: 2021-03- allowing the platform and third-party apps to become more 20. secure. Alepis et al. [5] illustrated several drawbacks of old [8] “Stack overflow,” https://stackoverflow.com/. permission model (prior to Android 6.0) and highlighted [9] “Post #58428763,” https://stackoverflow.com/questions/ the new features of the runtime permission model. Zhau- 58428763/android-10-not-working-with-ble-bluetooth- scanning, 2021, accessed: 2021-03-20. niarovich et al. [15] conducted a comprehensive study to [10] “Post #52781910,” https://stackoverflow.com/q/52781910/ explore the changes of permission mechanism from An- 12065597, 2021, accessed: 2021-03-20. droid 1.6 to Android 6.0. Calciati et al. [103] conducted [11] M. Dilhara, H. Cai, and J. Jenkins, “Automated detection and repair of incompatible uses of runtime permissions in android a preliminary study on over 14K releases of 227 Android apps,” in Proceedings of the 5th International Conference on Mobile apps, to understand how the apps evolved their permis- Software Engineering and Systems, 2018, pp. 67–71. sion requests across different releases, after migrating to [12] D. Bogdanas, “Dperm: Assisting the migration of android apps the runtime permission model. While these studies inves- to runtime permissions,” arXiv preprint arXiv:1706.05042, 2017. [13] Z. Fang, W. Han, D. Li, Z. Guo, D. Guo, X. S. Wang, Z. Qian, and tigated the evolution of the permission mechanism, they H. Chen, “revdroid: Code analysis of the side effects after dy- have not systematically characterized the issues caused by namic permission revocation of android apps,” in Proceedings of such evolution at the code level. In contrast, our work not the 11th ACM on Asia Conference on Computer and Communications only analyzed the evolution of permission mechanism from Security, 2016, pp. 747–758. [14] “Github,” https://github.com/. Android 6.0 to Android 10.0, but also investigated various [15] Y. Zhauniarovich and O. Gadyatskaya, “Small changes, big types of ARP issues and built by far the most comprehensive changes: an updated view on the android permission system,” issue taxonomy. in International Symposium on Research in Attacks, Intrusions, and Defenses. Springer, 2016, pp. 346–367. [16] D. Barrera, H. G. Kayacik, P. C. Van Oorschot, and A. Somayaji, 8 CONCLUSIONAND FUTUREWORK “A methodology for empirical analysis of permission-based se- In this work, we conducted a large-scale empirical study curity models and its application to android,” in Proceedings of the 17th ACM conference on Computer and communications security, of ARP issues in the Android ecosystem. We investigated 2010, pp. 73–84. 135 posts on Stack Overflow and 199 real ARP issues from [17] “So post 20740632,” https://stackoverflow.com/q/20740632, 415 Android projects on GitHub. Via analyzing these data, 2021, accessed: 2021-03-20. [18] M. Backes, S. Bugiel, E. Derr, P. McDaniel, D. Octeau, and S. Weis- we built a taxonomy of ARP issues and studied their root gerber, “On demystifying the android application framework: causes, pervasiveness, seriousness, and fixing strategies. In Re-visiting android permission specification analysis,” in 25th addition, we communicated with Android practitioners via USENIX Security Symposium USENIX Security 16, 2016, pp. 1101– online questionnaires and interviews to understand their 1118. [19] “Issue #72 of project secure-preferences,” https://github.com/ common practices and experiences in terms of handing scottyab/secure-preferences/issues/72, 2021, accessed: 2021-03- runtime permissions. From the studies, we obtained several 20. important findings that can facilitate future research on An- [20] “Issue #88 of project secure-preferences,” https://github.com/ droid runtime permissions and provide useful guidance to scottyab/secure-preferences/issues/88, 2021, accessed: 2021-03- 20. practitioners. Futhermore, to understand the state of the art [21] M. Linares-Vásquez, G. Bavota, M. Di Penta, R. Oliveto, and and the state of the practice, we investigated three existing D. Poshyvanyk, “How do api changes trigger stack overflow ARP issue detectors. With a carefully prepared benchmark, discussions? a study on the android sdk,” in proceedings of the we experimentally evaluated these detectors and presented 22nd International Conference on Program Comprehension, 2014, pp. 83–94. a detailed analysis of their limitations. In future, we plan [22] M. Duijn, A. Kucera, and A. Bacchelli, “Quality questions need to address the limitations of existing detectors and design quality code: Classifying code fragments on stack overflow,” more effective techniques to help developers detect and fix in 2015 IEEE/ACM 12th Working Conference on Mining Software Repositories. IEEE, 2015, pp. 410–413. ARP issues in their Android apps. [23] J. Zhou, S. Wang, C.-P. Bezemer, and A. E. Hassan, “Bounties on technical q&a sites: a case study of stack overflow bounties,” Empirical Software Engineering, vol. 25, no. 1, pp. 139–177, 2020. REFERENCES [24] “F-droid,” https://f-droid.org/en/packages/, 2021, accessed: [1] A. P. Felt, E. Chin, S. Hanna, D. Song, and D. Wagner, “Android 2021-03-20. permissions demystified,” in Proceedings of the 18th ACM confer- [25] “Google play,” https://play.google.com/, 2021, accessed: 2021- ence on Computer and communications security, 2011, pp. 627–638. 03-20. [2] “Android official document,” https://developer.android.com/ [26] J. W. Creswell, Qualitative Inquiry and Research Design: Choosing training/permissions/requesting?hl=en, 2021, accessed: 2021-03- Among Five Approaches (3rd Edition). SAGE Publications, Inc., 20. 2013. [3] P. Andriotis, M. A. Sasse, and G. Stringhini, “Permissions snap- [27] “Issue #1343 of project owncloud,” https://github.com/ shots: Assessing users’ adaptation to the android runtime permis- owncloud/android/issues/1343, 2021, accessed: 2021-03-20. sion model,” in 2016 IEEE International Workshop on Information [28] “So post 35248269,” https://stackoverflow.com/q/35248269, Forensics and Security (WIFS). IEEE, 2016, pp. 1–6. 2021, accessed: 2021-03-20. 21

[29] C. Xu, Y. Qin, P. Yu, C. Cao, and J. Lv, “Theories and techniques [59] A. Bartel, J. Klein, Y. Le Traon, and M. Monperrus, “Automati- for growing software: paradigm and beyond,” SCIENTIA SINICA cally securing permission-based software by reducing the attack Informationis, vol. 50, pp. 1595–1611, 2020. surface: An application to android,” in 2012 Proceedings of the [30] A. Dawoud and S. Bugiel, “Bringing balance to the force: Dy- 27th IEEE/ACM International Conference on Automated Software namic analysis of the android application framework,” Bringing Engineering. IEEE, 2012, pp. 274–277. Balance to the Force: Dynamic Analysis of the Android Application [60] A. Bartel, J. Klein, M. Monperrus, and Y. Le Traon, “Static analysis Framework, 2021. for extracting permission checks of a large scale framework: The [31] Y. Aafer, G. Tao, J. Huang, X. Zhang, and N. Li, “Precise android challenges and solutions for analyzing android,” IEEE Transac- api protection mapping derivation and reasoning,” in Proceedings tions on Software Engineering, vol. 40, no. 6, pp. 617–632, 2014. of the 2018 ACM SIGSAC Conference on Computer and Communica- [61] H. H. Nguyen, L. Jiang, and T. Quan, “Android repository mining tions Security, 2018, pp. 1151–1164. for detecting publicly accessible functions missing permission [32] “Issue #982 of project lawnchair,” https://github.com/ checks,” in 2017 IEEE/ACM 25th International Conference on Pro- LawnchairLauncher/Lawnchair/issues/982, 2021, accessed: gram Comprehension (ICPC). IEEE, 2017, pp. 324–327. 2021-03-20. [62] “Android sdk source code,” https:// [33] “So post 47787577,” https://stackoverflow.com/q/47787577, androidsdkmanager.azurewebsites.net/Sources, 2021, accessed: 2021, accessed: 2021-03-20. 2021-03-20. [34] “Issue #58 of project buglife-android,” https://github.com/ [63] “Libraries.io,” https://libraries.io/, 2021, accessed: 2021-03-20. Buglife/buglife-android/issues/58, 2021, accessed: 2021-03-20. [64] “Issue #650 of project commons-app,” https://github.com/ [35] “So post 39655365,” https://stackoverflow.com/a/39655365, commons-app/apps-android-commons/issues/650, 2021, ac- 2021, accessed: 2021-03-20. cessed: 2021-03-20. [36] “Issue #261 of project nemandroidapp,” https://github.com/ [65] “Issue #2110 of project k9mail,” https://github.com/k9mail/k- NemProject/NEMAndroidApp/issues/261, 2021, accessed: 9/issues/2110, 2021, accessed: 2021-03-20. 2021-03-20. [66] “Issue #76 of project qrcodereaderview,” https://github.com/ [37] “So post 59418504,” https://stackoverflow.com/q/59418504, dlazaro66/QRCodeReaderView/issues/76, 2021, accessed: 2021- 2021, accessed: 2021-03-20. 03-20. [38] “So post 43467522,” https://stackoverflow.com/q/43467522, [67] “Issue #269 of project react-native-device-info,” https: 2021, accessed: 2021-03-20. //github.com/react-native-community/react-native-device- [39] “Issue #125 of project qrcodereaderview,” https://github.com/ info/pull/269, 2021, accessed: 2021-03-20. dlazaro66/QRCodeReaderView/issues/125, 2021, accessed: [68] “Issue #168 of project apptentive-android,” https: 2021-03-20. //github.com/apptentive/apptentive-android/issues/168, [40] “So post 44374646,” https://stackoverflow.com/q/44374646, 2021, accessed: 2021-03-20. 2021, accessed: 2021-03-20. [69] “Specifications for merging manifest files,” https: [41] “Issue #229 of project dexter,” https://github.com/Karumi/ //developer.android.google.cn/studio/build/manifest- Dexter/issues/229, 2021, accessed: 2021-03-20. merge.html, 2021, accessed: 2021-03-20. [42] “So post 34959331,” https://stackoverflow.com/a/34959331, [70] “Issue #2 of project barcode-reader,” https://github.com/ 2021, accessed: 2021-03-20. ravi8x/Barcode-Reader/issues/2, 2021, accessed: 2021-03-20. [43] “Issue #1 of project swati4star,” https://github.com/ [71] “Issue #766 of project katzer,” https://github.com/katzer/ /Swati4star/Images-to-PDF/issues/1, 2021, accessed: 2021- cordova-plugin-local-notifications/issues/766, 2021, accessed: 03-20. 2021-03-20. [44] “So post 42762308,” https://stackoverflow.com/q/42762308, [72] “Hockeysdk-android,” https://github.com/bitstadium/ 2021, accessed: 2021-03-20. HockeySDK-Android, 2021, accessed: 2021-03-20. [45] “Issue #737 of project native-navigation,” https://github.com/ [73] “Issue #382 of project hockeysdk-android,” https://github.com/ wix/react-native-navigation/pull/737, 2021, accessed: 2021-03- bitstadium/HockeySDK-Android/issues/382, 2021, accessed: 20. 2021-03-20. [46] “Android permission usage notes,” https:// [74] “Issue #356 of project hockeysdk-android,” https://github.com/ developer.android.com/training/permissions/usage- bitstadium/HockeySDK-Android/issues/356, 2021, accessed: notes#be_transparent, 2021, accessed: 2021-03-20. 2021-03-20. [47] “So post 30719047,” https://stackoverflow.com/q/30719047, [75] “Issue #373 of project hockeysdk-android,” https://github.com/ 2021, accessed: 2021-03-20. bitstadium/HockeySDK-Android/issues/373, 2021, accessed: [48] “Issue #10 of project assent,” https://github.com/afollestad/ 2021-03-20. assent/issues/10, 2021, accessed: 2021-03-20. [76] “Pr #401 of project hockeysdk-android,” https://github.com/ [49] “So post 35989288,” https://stackoverflow.com/q/35989288, bitstadium/HockeySDK-Android/pull/401, 2021, accessed: 2021, accessed: 2021-03-20. 2021-03-20. [50] “Issue #228 of project openredmine,” https://github.com/ [77] “Lint,” https://developer.android.com/studio/write/lint, 2021, indication/OpenRedmine/issues/228, 2021, accessed: 2021-03- accessed: 2021-03-20. 20. [78] L. Wei, Y. Liu, and S.-C. Cheung, “Oasis: prioritizing static anal- [51] “So post 58059097,” https://stackoverflow.com/q/58059097, ysis warnings for android apps based on app user reviews,” in 2021, accessed: 2021-03-20. Proceedings of the 2017 11th Joint Meeting on Foundations of Software [52] “Issue #920 of project android-beacon-library,” https: Engineering, 2017, pp. 672–682. //github.com/AltBeacon/android-beacon-library/issues/920, [79] Y. Liu, J. Wang, L. Wei, C. Xu, S. Cheung, T. Wu, J. Yan, 2021, accessed: 2021-03-20. and J. Zhang, “Droidleaks: a comprehensive database of [53] “So post 54615936,” https://stackoverflow.com/q/54615936, resource leaks in android apps,” Empirical Software Engineering, 2021, accessed: 2021-03-20. vol. 24, no. 6, pp. 3435–3483, 2019. [Online]. Available: [54] “Issue #723 of project mapsforge,” https://github.com/ https://doi.org/10.1007/s10664-019-09715-8 /mapsforge/mapsforge/issues/723, 2021, accessed: 2021-03-20. [80] T. Wu, J. Liu, Z. Xu, C. Guo, Y. Zhang, J. Yan, and J. Zhang, “Light- [55] “So post 36693127,” https://stackoverflow.com/q/36693127, weight, inter-procedural and callback-aware resource leak detec- 2021, accessed: 2021-03-20. tion for android apps,” IEEE Transactions on Software Engineering, [56] “So post 39603098,” https://stackoverflow.com/q/39603098, vol. 42, no. 11, pp. 1054–1076, 2016. 2021, accessed: 2021-03-20. [81] “Issue #90 of project /stardroid,” https://github.com/sky-map- [57] “Top device manufacturers in the android markets,” https: team/stardroid/pull/90/files, 2021, accessed: 2021-03-20. //www.appbrain.com/stats/top-manufacturers, 2021, accessed: [82] Z. Fang, W. Han, and Y. Li, “Permission based android security: 2021-03-20. Issues and countermeasures,” computers & security, vol. 43, pp. [58] K. W. Y. Au, Y. F. Zhou, Z. Huang, and D. Lie, “Pscout: analyzing 205–218, 2014. the android permission specification,” in Proceedings of the 2012 [83] E. Fragkaki, L. Bauer, L. Jia, and D. Swasey, “Modeling and ACM conference on Computer and communications security, 2012, pp. enhancing android’s permission system,” in European Symposium 217–228. on Research in Computer Security. Springer, 2012, pp. 1–18. 22

[84] M. Nauman, S. Khan, and X. Zhang, “Apex: extending android permission model and enforcement with user-defined runtime constraints,” in Proceedings of the 5th ACM symposium on informa- tion, computer and communications security, 2010, pp. 328–332. [85] X. Wei, L. Gomez, I. Neamtiu, and M. Faloutsos, “Permission evolution in the android ecosystem,” in Proceedings of the 28th Annual Computer Security Applications Conference, 2012, pp. 31–40. [86] P. Wijesekera, A. Baokar, A. Hosseini, S. Egelman, D. Wagner, and K. Beznosov, “Android permissions remystified: A field study on contextual integrity,” in 24th USENIX Security Symposium USENIX Security 15, 2015, pp. 499–514. [87] L. Li, A. Bartel, T. F. Bissyandé, J. Klein, Y. Le Traon, S. Arzt, S. Rasthofer, E. Bodden, D. Octeau, and P. McDaniel, “Iccta: Detecting inter-component privacy leaks in android apps,” in 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering, vol. 1. IEEE, 2015, pp. 280–291. [88] L. Li, A. Bartel, J. Klein, Y. L. Traon, S. Arzt, S. Rasthofer, E. Bodden, D. Octeau, and P. Mcdaniel, “I know what leaked in your pocket: uncovering privacy leaks on android apps with static taint analysis,” arXiv preprint arXiv:1404.7431, 2014. [89] L. Bao, D. Lo, X. Xia, and S. Li, “What permissions should this android app request?” in 2016 International Conference on Software Analysis, Testing and Evolution (SATE). IEEE, 2016, pp. 36–41. [90] Z. Liu, X. Xia, D. Lo, and J. Grundy, “Automatic, highly accurate app permission recommendation,” Automated Software Engineer- ing, vol. 26, no. 2, pp. 241–274, 2019. [91] H. Bagheri, E. Kang, S. Malek, and D. Jackson, “Detection of design flaws in the android permission protocol through bounded verification,” in International Symposium on Formal Meth- ods. Springer, 2015, pp. 73–89. [92] ——, “A formal approach for detection of security flaws in the android permission system,” Formal Aspects of Computing, vol. 30, no. 5, pp. 525–544, 2018. [93] H. Bagheri, A. Sadeghi, J. Garcia, and S. Malek, “Covert: Compo- sitional analysis of android inter-app permission leakage,” IEEE transactions on Software Engineering, vol. 41, no. 9, pp. 866–886, 2015. [94] B. Liu, J. Lin, and N. Sadeh, “Reconciling mobile app privacy and usability on smartphones: Could user privacy profiles help?” in Proceedings of the 23rd international conference on World wide web, 2014, pp. 201–212. [95] A. P. Felt, S. Egelman, M. Finifter, D. Akhawe, D. A. Wagner et al., “How to ask for permission.” HotSec, vol. 12, pp. 7–7, 2012. [96] S. Bugiel, S. Heuser, and A.-R. Sadeghi, “Flexible and fine-grained mandatory access control on android for diverse security and privacy policies,” in Presented as part of the 22nd USENIX Security Symposium USENIX Security 13, 2013, pp. 131–146. [97] S. Heuser, A. Nadkarni, W. Enck, and A.-R. Sadeghi, “Asm: A programmable interface for extending android security,” in 23rd USENIX Security Symposium USENIX Security 14, 2014, pp. 1005– 1019. [98] Y. Zhou, X. Zhang, X. Jiang, and V. W. Freeh, “Taming information-stealing smartphone applications (on android),” in International conference on Trust and trustworthy computing. Springer, 2011, pp. 93–107. [99] Y. Agarwal and M. Hall, “Protectmyprivacy: detecting and mit- igating privacy leaks on devices using crowdsourcing,” in Proceeding of the 11th annual international conference on Mobile systems, applications, and services, 2013, pp. 97–110. [100] K. Olejnik, I. Dacosta, J. S. Machado, K. Huguenin, M. E. Khan, and J.-P. Hubaux, “Smarper: Context-aware and automatic runtime-permissions for mobile devices,” in 2017 IEEE Sympo- sium on Security and Privacy (SP). IEEE, 2017, pp. 1058–1076. [101] X. Liu, Y. Leng, W. Yang, W. Wang, C. Zhai, and T. Xie, “A large- scale empirical study on android runtime-permission rationale messages,” in 2018 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC). IEEE, 2018, pp. 137–146. [102] B. Shen, L. Wei, C. Xiang, Y. Wu, M. Shen, Y. Zhou, and X. Jin, “Can systems explain permissions better? understanding users’ misperceptions under smartphone runtime permission model,” in 30th USENIX Security Symposium (USENIX Security 21), 2021. [103] P. Calciati and A. Gorla, “How do apps evolve in their permission requests? a preliminary study,” in 2017 IEEE/ACM 14th Interna- tional Conference on Mining Software Repositories (MSR). IEEE, 2017, pp. 37–41.