CN110196744A - 一种实现App禁用截屏后仍同步手机屏幕到PC端的方法 - Google Patents

一种实现App禁用截屏后仍同步手机屏幕到PC端的方法 Download PDF

Info

Publication number
CN110196744A
CN110196744A CN201910426580.3A CN201910426580A CN110196744A CN 110196744 A CN110196744 A CN 110196744A CN 201910426580 A CN201910426580 A CN 201910426580A CN 110196744 A CN110196744 A CN 110196744A
Authority
CN
China
Prior art keywords
activity
mobile phone
screenshotss
app
disabling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910426580.3A
Other languages
English (en)
Inventor
陈杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chen Jie
Original Assignee
Shenzhen Unicom Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Unicom Technology Co Ltd filed Critical Shenzhen Unicom Technology Co Ltd
Priority to CN201910426580.3A priority Critical patent/CN110196744A/zh
Publication of CN110196744A publication Critical patent/CN110196744A/zh
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • G06F9/452Remote windowing, e.g. X-Window System, desktop virtualisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Telephone Function (AREA)

Abstract

本发明公开了一种实现App禁用截屏后仍同步手机屏幕到PC端的方法,主要解决现有技术中存在的当APP禁用截屏后,手机屏幕不能同步到PC端的问题。该方法包括(S1)打开安卓手机的USB调试模式;(S2)将手机与PC端连接;(S3)在PC端中进入Android测试环境,然后利用Instrumentation方式启动禁用截屏的APP;(S4)拉起QtInstrumentation Test Runner,使其继承android.test.InstrumentationTestRunner类,并重载其中的public void callActivityOnCreate (Activity activity,Bundle icicle)和public void callActivityOnCreate (Activity activity,Bundle icicle,PersistableBundlepersistentState)语句以实现对Activity中的On Create事件进行监听;(S5)加载禁用截屏的APP的Activity,清除其中的WindowManagerLayoutParams FLAG_SECURE标识;(S6)将手机屏幕同步到PC端。本发明达到了手机APP禁止截屏后仍能同步到PC端的目的,具有很高的实用价值和推广价值。

Description

一种实现App禁用截屏后仍同步手机屏幕到PC端的方法
技术领域
本发明属于Android App 自动化测试工具技术领域,具体地讲,是涉及一种实现App禁用截屏后仍同步手机屏幕到PC端的方法。
背景技术
Android手机厂商可以自由定制自己的系统,导致现在Android碎片化严重,在开发Android应用时,需要在大量手机上做兼容性测试。这类测试一般都是手工进行,效率非常低,不仅费时费力,而且也很容易出错。因此出现了很多自动化测试工具。现在有很多的Android App自动化测试工具都需要同步手机屏幕到PC端,以便用户在PC端进行操作时能够记录用户的操作,生成测试脚本。然后也有些APP例如理财或者有安全需求的App都会禁止手机截屏,避免信息泄露,由于无法实现截屏,现有Android App测试工具则不能做到将手机屏幕同步到PC端,导致无法录制生成测试脚本,最终无法对这类App进行自动化测试。因此如何解决APP禁用截屏后仍然能够将手机屏幕同步到PC端是本领域技术人员亟需解决的问题。
发明内容
本发明的目的在于提供一种实现App禁用截屏后仍同步手机屏幕到PC端的方法,主要解决现有技术中存在的当APP禁用截屏后,手机屏幕不能同步到PC端的问题。
为了实现上述目的,本发明采用的技术方案如下:
一种实现App禁用截屏后仍同步手机屏幕到PC端的方法,包括如下步骤:
(S1)打开安卓手机的USB调试模式;
(S2)将手机与PC端连接;
(S3)在PC端中进入Android测试环境,然后利用Instrumentation方式启动禁用截屏的APP;
(S4)拉起QtInstrumentation Test Runner,使其继承android.test.InstrumentationTestRunner类,并重载其中的public void callActivityOnCreate (Activityactivity, Bundle icicle)和public void callActivityOnCreate (Activityactivity, Bundle icicle, PersistableBundlepersistentState)语句以实现对Activity中的On Create事件进行监听;
(S5)加载禁用截屏的APP的Activity,清除其中的WindowManagerLayoutParams FLAG_SECURE标识;
(S6)将手机屏幕同步到PC端。
与现有技术相比,本发明具有以下有益效果:
本发明通过使用上述方法,解决禁用屏幕截屏的App无法同步手机屏幕到PC端的问题,使得依靠同步手机屏幕到PC端的自动化测试工具最终能对此类App也能进行自动化测试。
附图说明
图1为本发明的系统流程图。
具体实施方式
下面结合附图和实施例对本发明作进一步说明,本发明的实施方式包括但不限于下列实施例。
实施例
如图1所示,一种实现App禁用截屏后仍同步手机屏幕到PC端的方法,包括如下步骤:(S1)打开安卓手机的USB调试模式;(S2)将手机与PC端连
接;(S3)在PC端中进入Android测试环境,然后利用Instrumentation方式启动禁用截屏的APP;(S4)拉起QtInstrumentation Test Runner,使其继承android.test.InstrumentationTestRunner类,并重载其中的public void callActivityOnCreate (Activityactivity, Bundle icicle)和public void callActivityOnCreate (Activityactivity, Bundle icicle, PersistableBundlepersistentState)语句以实现对Activity中的On Create事件进行监听;(S5)加载禁用截屏的APP的Activity,清除其中的WindowManagerLayoutParams FLAG_SECURE标识;(S6)将手机屏幕同步到PC端。
具体包括以下两种方式,方法一:通过设置Activity的WindowManager.LayoutParams.FLAG_SECURE标识来实现,而Android Instrumentation机制允许测试代码自由的控制App的生命周期跟各种事件。所以,通过Instrumentation机制,在Activity启动后清除WindowManager.LayoutParams.FLAG_SECURE标识即可绕过App禁用手机屏幕截屏,实现跟PC端同步手机屏幕。
方法二:通过继承android.test.InstrumentationTestRunner类,并重载其中的
public void callActivityOnCreate (Activity activity, Bundle icicle)
public void callActivityOnCreate (Activity activity, Bundle icicle, PersistableBundlepersistentState)
两个方法,都能清除WindowManager.LayoutParams.FLAG_SECURE标识,当清除了WindowManager.LayoutParams.FLAG_SECURE标识后,PC端就可以克服APP由于不能截屏从而无法同步到PC端的问题,并且解决了这个问题,就可以对手机进行自动化测试,克服了行业难题,实用性强。
上述实施例仅为本发明的优选实施例,并非对本发明保护范围的限制,但凡采用本发明的设计原理,以及在此基础上进行非创造性劳动而做出的变化,均应属于本发明的保护范围之内。

Claims (1)

1.一种解决App禁用截屏后不能同步手机屏幕到PC端的方法,其特征在于,包括以下步骤:
(S1)打开安卓手机的USB调试模式;
(S2)将手机与PC端连接;
(S3)在PC端中进入Android测试环境,然后利用Instrumentation方式启动禁用截屏的APP;
(S4)拉起QtInstrumentation Test Runner,使其继承android.test.InstrumentationTestRunner类,并重载其中的public void callActivityOnCreate (Activityactivity, Bundle icicle)和public void callActivityOnCreate (Activityactivity, Bundle icicle, PersistableBundlepersistentState)语句以实现对Activity中的On Create事件进行监听;
(S5)加载禁用截屏的APP的Activity,清除其中的WindowManagerLayoutParams FLAG_SECURE标识;
(S6)将手机屏幕同步到PC端。
CN201910426580.3A 2019-05-22 2019-05-22 一种实现App禁用截屏后仍同步手机屏幕到PC端的方法 Pending CN110196744A (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910426580.3A CN110196744A (zh) 2019-05-22 2019-05-22 一种实现App禁用截屏后仍同步手机屏幕到PC端的方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910426580.3A CN110196744A (zh) 2019-05-22 2019-05-22 一种实现App禁用截屏后仍同步手机屏幕到PC端的方法

Publications (1)

Publication Number Publication Date
CN110196744A true CN110196744A (zh) 2019-09-03

Family

ID=67751621

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910426580.3A Pending CN110196744A (zh) 2019-05-22 2019-05-22 一种实现App禁用截屏后仍同步手机屏幕到PC端的方法

Country Status (1)

Country Link
CN (1) CN110196744A (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116089256A (zh) * 2022-05-13 2023-05-09 荣耀终端有限公司 终端测试方法、装置及存储介质
US11909807B2 (en) 2022-05-18 2024-02-20 Demostack, Inc. Local recording for demonstration of web-based software applications
US12019699B2 (en) 2021-10-07 2024-06-25 Demostack, Inc. Visual recorder for demonstrations of web-based software applications

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US12019699B2 (en) 2021-10-07 2024-06-25 Demostack, Inc. Visual recorder for demonstrations of web-based software applications
CN116089256A (zh) * 2022-05-13 2023-05-09 荣耀终端有限公司 终端测试方法、装置及存储介质
CN116089256B (zh) * 2022-05-13 2024-03-12 荣耀终端有限公司 终端测试方法、装置及存储介质
US11909807B2 (en) 2022-05-18 2024-02-20 Demostack, Inc. Local recording for demonstration of web-based software applications

Similar Documents

Publication Publication Date Title
CN110196744A (zh) 一种实现App禁用截屏后仍同步手机屏幕到PC端的方法
US20070094541A1 (en) Method and apparatus for generating test execution sequences automatically for a software testing process
CN105373419A (zh) 一种后台应用的操作方法及装置
CN105260315A (zh) 一种在嵌入式系统进程中调试日志的方法
CN104407980A (zh) 移动应用自动化测试装置和方法
CN103605606B (zh) 一种可自动转换的嵌入式软件测试用例批量执行方法
US10078510B1 (en) Late-stage software feature reduction tool for security and performance
CN105512562B (zh) 一种漏洞挖掘方法、装置及电子设备
US20190251219A1 (en) Correlating verification scenario coverage with hardware coverage events
CN104268310A (zh) 使用专用图形界面调用uvm验证环境的方法
Devai et al. UML Model Execution via Code Generation.
CN109344074A (zh) 一种跨平台自动化测试方法及系统
CN103699478A (zh) 一种测试案例生成系统和方法
CN105868132B (zh) 一种基于usb通信的数字示波器模块化功能拓展方法及系统
CN103077115B (zh) 一种兼容性测试平台搭建方法及装置
CN108132881A (zh) 一种自动化测试方法及系统
CN110941422B (zh) 代码自动生成方法、代码生成器及可读存储介质
CN103761096A (zh) 基于IBinder机制实现的自动输入方法及装置
Penna et al. Reconfiguring CPLD to perform operations based on sequence detection condition
CN102163149A (zh) Java-CAT可视化开发系统及方法
CN107885527A (zh) 一种测试系统的代码修改方法及装置
CN105867894A (zh) 开发环境自动创建方法及系统
CN103559094B (zh) 一种对移动终端的资源进行管理的方法
Hamann et al. Abstract runtime monitoring with USE
CN102819484B (zh) 软件测试方法及其测试装置

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
TA01 Transfer of patent application right

Effective date of registration: 20210310

Address after: Room 403, block B, building 38, qianlinshanju District, zhugushi Road, Longgang District, Shenzhen City, Guangdong Province 518100

Applicant after: Chen Jie

Address before: 518000 room 205, block a, 2nd floor, building 2, Chuangye Hongwei Hongjing Huating, Wulian zhugushi village, Longcheng street, Longgang District, Shenzhen City, Guangdong Province

Applicant before: Shenzhen Unicom Technology Co.,Ltd.

TA01 Transfer of patent application right
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190903

WD01 Invention patent application deemed withdrawn after publication