Hardware-Aware Conditional Code in Android Apps
Marco Alecci, Jordan Samhi, Li Li, Tegawend\'e F. Bissyand\'e, Jacques Klein
Key points
From the paper's conclusion- We statically analyze 50,000 apps to identify the if statements whose conditions depend on the values of hardware-related APIs, and extract their conditions together with the code of their branches.
Abstract
Android OS runs on a highly diverse set of devices, spanning entry-level phones and flagships with substantially different hardware characteristics, including memory capacity, processors, displays, cameras, and sensors. Through APIs, apps can query device information at runtime, such as memory, hardware features, and manufacturer, among other device properties, allowing developers to execute different code paths on different devices. Existing studies cover only specific compatibility bugs or brand-specific behavior; however, the broader use of hardware information in app logic has not been comprehensively explored. We address this question with a large-scale empirical study of hardware-related if statements in Android apps. We statically analyze 50,000 apps to identify the if statements whose conditions depend on the values of hardware-related APIs, and extract their conditions together with the code of their branches. Our results show that 95% of successfully analyzed apps contain at least one such statement, with an average of 74 per app, which suggests that hardware-related logic is widespread. We then apply an LLM-assisted open-coding process to the extracted code to build a structured taxonomy of the purposes behind hardware-related conditional code. The resulting characterization shows that developers use hardware information for feature availability checks, UI adaptation, emulator detection, device tiering, and resource management, among others.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Reassessing feature-based Android malware detection in a contemporary contextPLoS ONE · 2026
- Inside Job: The Methods, Challenges, and Opportunities for On-Device Data Acquisition on AndroidDigital Threats: Research and Practice · 2026
- Robotic-supported Data Loss Detection in Android ApplicationsarXiv · 2026
- OptiMine: Scalable and Precise Code Optimization for Android Apps via LLM-Driven Semantic AnalysisProceedings of the ACM on Software Engineering · 2026
- AI-Powered Android Malware Detection Using Deep Learning Hybrid Static–Dynamic Feature-Engineered Framework with Explainable AIMathematical and Computational Applications · 2026
- Deep learning-based android malware detection under realistic evaluation constraints: an architecture-centric review and reliability-aware empirical validation.Frontiers in artificial intelligence · 2026