计算机科学 ›› 2022, Vol. 49 ›› Issue (12): 136-145.doi: 10.11896/jsjkx.211100066

• 计算机软件 • 上一篇    下一篇

基于计算反射的Android应用程序接口自动生成方法

王毅1,2, 陈迎仁1,2, 陈星1,2, 林兵2,3, 马郓4   

  1. 1 福州大学数学与计算机科学学院 福州350116
    2 福建省网络计算与智能信息处理重点实验室 福州350116
    3 福建师范大学物理与能源学院 福州350117
    4 北京大学信息科学技术学院 北京100871
  • 收稿日期:2021-11-05 修回日期:2022-07-28 发布日期:2022-12-14
  • 通讯作者: 陈星(chenxing@fzu.edu.cn)
  • 作者简介:(396882243@qq.com)
  • 基金资助:
    国家重点研发计划(2018YFB1004800);福建省自然科学基金杰青项目(2020J06014);中央引导地方科技发展专项(2019L3002)

Automating Release of Android APIs Based on Computational Reflection

WANG Yi1,2, CHEN Ying-ren1,2, CHEN Xing1,2, LIN Bin2,3, MA Yun4   

  1. 1 College of Mathematics and Computer Science,Fuzhou University,Fuzhou 350116,China
    2 Fujian Key Laboratory of Network Computing and Intelligent Information Processing,Fuzhou 350116,China
    3 College of Physics and Energy,Fujian Normal University,Fuzhou 350117,China
    4 School of Electronics Engineering and Computer Science,Peking University,Beijing 100871,China
  • Received:2021-11-05 Revised:2022-07-28 Published:2022-12-14
  • About author:WANG Yi,born in 1996,postgraduate.His main research interests include Android application service generation and Android application service adaptation.CHEN Xing,born in 1985,Ph.D,professor,Ph.D supervisor,is a member of China Computer Federation.His main research interests include system software,software self-adaptation and cloud computing.
  • Supported by:
    National Key R & D Program of China(2018YFB1004800),Natural Science Foundation of Fujian Province for Distinguished Young Scholars(2020J06014) and Special Project on Science and Technology Development of Central Government Guiding Local Government(2019L3002).

摘要: 随着移动设备硬件技术和5G等通信技术的发展,智能应用软件不断涌现,其提供的功能已涉及人们生活和工作的方方面面。应用内功能众多,不仅可以满足应用使用者的需求,还能被进一步发布成应用程序接口(API)用于外部调用,例如应用发布的API可以被智能语音助手调用。然而,为了生成应用内功能的API,开发者通常需要在应用开发阶段通过手工编码来实现,对于开发时没有发布的API,在应用上线以后,其功能则无法被外部调用。针对此问题,文中提出了一种基于计算反射的Android 应用API自动生成方法。该方法能够在不修改源代码的情况下,基于计算反射机制重建Android应用的Activity界面运行时软件体系结构;面向指定功能的测试用例,分析用户行为工作流以及对应的程序调用;通过模拟用户行为的方式调用指定功能,并生成对应的API。针对“豌豆荚”Android应用商店中的300个流行应用进行方法评估,实验结果显示,所提方法适用于其中的280个应用;对于指定功能,所提方法能够在15 min左右实现其API,且API的性能满足外部调用的需求。

关键词: API生成, Android应用, 计算反射, 运行时软件体系结构, 工作流

Abstract: With the development of mobile hardware and 5G communication technologies,smart applications are booming,which has penetrated into all the aspects of our life and work.There are many functions in applications,which can not only satisfy the user’s requirements,but also be further released as APIs for external invocations.For instance,the APIs provided by applications can be invoked by the intelligent voice assistant.However,these functions must be released as APIs during the development phase,otherwise they cannot be used for external invocations.To address this problem,this paper proposes an approach to automatic release of APIs of Android applications based on computational reflection.It first rebuilds runtime software architecture for the activities of Android applications based on the reflection mechanism,without modifying the source code of application.Then,based on test cases of the specified function,it analyzes its user-behavior workflow and corresponding procedure calls.Finally,the function can be invoked by simulating the user behaviors,and then is released as the corresponding API.We evaluate our approach with 300 popular apps on Android app store Wandoujia,and the results show that our approach is effective for 280 of them.For the specified functions,APIs can be implemented by our approach in about 15 minutes,and their runtime performance is desirable.

Key words: API generation, Android app, Computational reflection, Runtime software architecture, Workflow

中图分类号: 

  • TP391
[1]Mobile Internet Use Passes Desktop[EB/OL].https://techcrunch.com/2016/11/01/mobile-internet-use-passes-desktop-for-the-first-time-study-finds.
[2]WANG H Y,LIU Z,GUO Y,et al.An Explorative Study of the Mobile App Ecosystem from App Developers’ Perspective[C]//Proceedings of the 26th International Conference on World Wide Web.Switzerland:WWW,2017:163-172.
[3]Activity[OL].https://developer.android.google.cn/guide/components/activities/intro-activities?hl=zh_cn.
[4]MA Y,HU Z N,LIU Y Z,et al.Aladdin:Automating Release of DeepLink APIs on Android[C]//Proceedings of the 2018 World Wide Web Conference.Switzerland:WWW,2018:1469-1478.
[5]Wandoujia [OL].https://www.wandoujia.com.
[6]Mobile deep linking[OL].https://en.wikipedia.org/wiki/Mobile_deep_linking.
[7]AZIM T,RIVA O,NATH S.ULink:Enabling User-DefinedDeep Linking to App Content[C]//Proceedings of the 14th Annual International Conference on Mobile Systems,Applications,and Services.New York:Association for Computing Machinery,2016:305-318.
[8]MAES P.Concepts and Experiments in Computational Reflection[C]//Proceedings of Object-oriented Programming Systems,Languages and Applications.New York:Association for Computing Machinery,1987:147-155.
[9]RODRÍGUEZ-ECHEVERRÍA R,MACÍAS F,PAVÓN V M,et al.Model-Driven Generation of A Rest API from A Legacy Web Application[C]//Proceedings of the 9th International Workshop on Model-Driven and Agile Engineering for the Web.Berlin:Springer-Verlag,2013:133-147.
[10]JIANG Y,ELENI S.Towards Reengineering Web Sites to Web-Services Providers[C]//Proceedings of the 8th European Conference on Software Maintenance and Reengineering.Piscataway,NJ:IEEE,2004:296-305.
[11]ZHANG S,CAI H Q,MA Y,et al.SmartPipe:Towards Inter-operability of Industrial Applications via Computational Reflection[J].Journal of Computer Science & Technology,2020,35(1):161-178.
[12]CANFORA G,FASOLINO A R,FRATTOLILLO G,et al.Migrating Interactive Legacy Systems to Web Services[C]//Proceedings of the 10th European Conference on Software Maintenance and Reengineering.Piscataway,NJ:IEEE,2006:24-36.
[13]CANFORA G,FASOLINO A R,FRATTOLILLO G,et al.A Wrapping Approach for Migrating Legacy System Interactive Functionalities to Service Oriented Architectures[J].Journal of Systems and Software,2008,81(4):463-480.
[14]LIU G G,HU C S M,CHEN S H,et al.Refactoring Java Code for Automatic API Generation[C]//Proceedings of the 2018 International Conference on Cloud Computing,Big Data and Blockchain.Piscataway,NJ:IEEE,2018:1-6.
[15]BENCOMO N,BLAIR G,FRANCE R.Summary of the Workshop Models@Run.Time at MoDELS 2006[C]//Proceedings of the 2006 International Conference on Models in Software Engineering.Berlin:Springer-Verlag,2006:227-231.
[16]BLAIR G,BENCOMO N,FRANCE R.Models@Run.Time[J].Computer,2009,42(10):22-27.
[17]SONG H,HUANG G,CHAUVEL F,et al.Supporting Runtime Software Architecture:A Bidirectional-Transformation-Based Approach[J].Journal of Systems & Software,2011,84(5):711-723.
[18]HUANG G,SONG H,MEI H.SM@RT:Applying Architec-ture-Based Runtime Management of Internetware Systems[J].International Journal of Software and Informatics,2009,3(4):439-464.
[19]SONG H,HUANG G,WU Y H,et al.Modeling and Maintaining Runtime Software Architectures[J].Ruan Jian Xue Bao/Journal of Software,2014,25(7):1731-1745.
[20]Peking University.SM@RT:Supporting Models at Run-time[OL].2009.http://code.google.com/p/smatrt/.
[21]OCTEAU D,LUCHAUP D,DERING M,et al.Composite Constant Propagation:Application to Android Inter-Component Communication Analysis[C]//Proc of the 37th IEEE/ACM International Conference on Software Engineering.Piscataway,NJ:IEEE,2015:77-88.
[22]ROUNTEV A,YAN D C,YANG S Q,et al.GATOR:Program Analysis Toolkit for Android [EB/OL].[2021-05-12].http://web.cse.ohio-state.edu/presto/software/gator/.
[23]Android API Reference.Android Developers[EB/OL].https://developer.android.google.cn/reference.
[24]HE X,XIE Z P.Structural Similarity Measurement of Web Pages Based on Simple Tree Matching Algorithm[J].Journal of Computer Research and Development,2007,44(Z3):1-6.
[25]Google App Indexing[EB/OL].https://developers.google.com/app-indexing/.
[26]Bing App Linking[EB/OL].https://msdn.microsoft.com/en-us/library/dn614167.
[27]Facebook App Links[EB/OL].https://developers.facebook.com/docs/applinks.
[28]GOMEZ L,NEAMTIU I,AZIM T,et al.RERAN:Timing-and Touch-Sensitive Record and Replay for Android[C]//Procee-dings of the 35th International Conference on Software Enginee-ring.Piscataway,NJ:IEEE,2013:72-81.
[29]HU Y J,AZIM T,NEAMTIU I.Versatileyet Lightweight Re-cord-and-Replay for Android[C]//Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming,Systems,Languages,and Applications.New York:Association for Computing Machinery,2015:349-366.
[30]ZHANG J H,SHEN L W,PENG X,et al.MashReDroid:enabling end-user creation of Android mashups based on record and replay[J].Journal of Science China Information Sciences,2020,63(10):50-69.
[31]KONG P,LI L,GAO J,et al.Automated Testing of Android Apps:A Systematic Literature Review[J].Journal of IEEE Transactions on Reliability,2019,68(1):45-66.
[32]LAI D,RUBIN J.Goal-Driven Exploration for Android Applications[C]//Proceedings of 34th IEEE/ACM International Conference on Automated Software Engineering.2019:115-127.
[1] 王毅, 李政浩, 陈星.
基于用户场景的Android 应用服务推荐方法
Recommendation of Android Application Services via User Scenarios
计算机科学, 2022, 49(6A): 267-271. https://doi.org/10.11896/jsjkx.210700123
[2] 柳鹏, 刘波, 周娜琴, 彭心怡, 林伟伟.
混合云工作流调度综述
Survey of Hybrid Cloud Workflow Scheduling
计算机科学, 2022, 49(5): 235-243. https://doi.org/10.11896/jsjkx.210300303
[3] 林潮伟, 林兵, 陈星.
边缘环境下基于模糊理论的科学工作流调度研究
Study on Scientific Workflow Scheduling Based on Fuzzy Theory Under Edge Environment
计算机科学, 2022, 49(2): 312-320. https://doi.org/10.11896/jsjkx.201000102
[4] 王子健, 卢政昊, 潘纪奎, 孙福权.
云中满足截止时间约束且优化成本的工作流调度策略
Workflow Scheduling Strategy for Deadline Constrained and Cost Optimization in Cloud
计算机科学, 2022, 49(11A): 210800154-6. https://doi.org/10.11896/jsjkx.210800154
[5] 于浩雯, 刘波, 周娜琴, 林伟伟, 柳鹏.
多云工作流调度综述
Survey of Multi-cloud Workflow Scheduling
计算机科学, 2022, 49(11): 250-258. https://doi.org/10.11896/jsjkx.211200234
[6] 窦帅, 李子扬, 朱家佳, 李晓辉, 李雪松, 米琳, 杨光, 李传荣.
基于jBPM的科学试验管理系统的设计与实现
Design and Implementation of Scientific Experiment Management System Based on jBPM
计算机科学, 2021, 48(6A): 658-663. https://doi.org/10.11896/jsjkx.200600158
[7] 刘漳辉, 赵旭, 林兵, 陈星.
混合云环境下基于模糊理论的科学工作流数据布局策略
Data Placement Strategy of Scientific Workflow Based on Fuzzy Theory in Hybrid Cloud
计算机科学, 2021, 48(11): 199-207. https://doi.org/10.11896/jsjkx.200900009
[8] 马堉银, 郑万波, 马勇, 刘航, 夏云霓, 郭坤银, 陈鹏, 刘诚武.
一种基于深度强化学习与概率性能感知的边缘计算环境多工作流卸载方法
Multi-workflow Offloading Method Based on Deep Reinforcement Learning and ProbabilisticPerformance-awarein Edge Computing Environment
计算机科学, 2021, 48(1): 40-48. https://doi.org/10.11896/jsjkx.200900195
[9] 张龙信, 周立前, 文鸿, 肖满生, 邓晓军.
基于异构云计算的成本约束下的工作流能量高效调度算法
Energy Efficient Scheduling Algorithm of Workflows with Cost Constraint in Heterogeneous Cloud Computing Systems
计算机科学, 2020, 47(8): 112-118. https://doi.org/10.11896/jsjkx.200300038
[10] 孙敏, 陈中雄, 叶侨楠.
云环境下基于HEDSM的工作流调度策略
Workflow Scheduling Strategy Based on HEDSM Under Cloud Environment
计算机科学, 2020, 47(6): 252-259. https://doi.org/10.11896/jsjkx.190400047
[11] 章宗美, 桂盛霖, 任飞.
基于N-gram 的Android恶意检测
Android Malware Detection Based on N-gram
计算机科学, 2019, 46(2): 145-151. https://doi.org/10.11896/j.issn.1002-137X.2019.02.023
[12] 徐俊, 项倩红, 肖刚.
基于改进混合蛙跳算法的云工作流负载均衡调度优化
Load Balancing Scheduling Optimization of Cloud Workflow Using Improved Shuffled Frog Leaping Algorithm
计算机科学, 2019, 46(11): 315-322. https://doi.org/10.11896/jsjkx.181001866
[13] 杜艳明, 肖建华.
云环境下基于优先级的多QoS约束工作流调度
Workflow Scheduling Strategy with Multi-QoS Constraint Based on Priority in Cloud Environment
计算机科学, 2019, 46(10): 128-134. https://doi.org/10.11896/jsjkx.180801591
[14] 徐健锐, 朱会娟.
基于自适应惩罚函数的云工作流调度协同进化遗传算法
Coevolutionary Genetic Algorithm of Cloud Workflow Scheduling Based on Adaptive Penalty Function
计算机科学, 2018, 45(8): 105-112. https://doi.org/10.11896/j.issn.1002-137X.2018.08.019
[15] 何思源,欧博,廖鑫.
分布式工作流环境下角色匹配的访问控制模型
Role Matching Access Control Model for Distributed Workflow
计算机科学, 2018, 45(7): 129-134. https://doi.org/10.11896/j.issn.1002-137X.2018.07.021
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!