VII. Android Phone Initialization¶
1.Preface¶
In AirtestIDE version 1.2.13, we have added a new function for initializing Android phone settings (referred to as phone initialization function below). With this function, assuming that USB debugging has been enabled on the phone and PocoService has been installed, certain phone settings can be automatically set.
For example, sometimes we may forget to enable Pocoservice auto-start, enable the Yosemite input method, or turn off the security keyboard, and even newcomers may not know which settings need to be operated on. In this case, we can use the phone initialization function provided by version 1.2.13 to help us automatically set these options.
2.Preparations¶
Please make sure that all of the following steps have been completed, otherwise, you will not be able to use the phone initialization function for automatic initialization:
1)Turn on USB debugging.¶
Turn on Developer Options, open Developer Options on your phone and allow USB debugging.
2)Connect your phone using a USB cable and trust the device.¶
Connect your phone using a USB cable. When a trust prompt pops up on your phone, click "trust".
3)You can see the device after enabling adb devices.¶
After confirming that the phone can successfully enable adb devices, we can see the device in the device list.
4)Confirm phone settings¶
- For some brands such as OPPO/VIVO/Realme phones, you must log in to the account first to install the APK. Please log in to the account in advance to facilitate the subsequent installation steps of the apks (Yosemite.apk and pocoservice.apk).
- For Xiaomi phones, you need to confirm that the [USB debugging (security settings) - allow simulated clicks] has been turned on.
3.How to use¶
1)Initialisation function entry.¶
After the preparation work is done, we can click "Refresh ADB" in the device window of AirtestIDE, wait for the list of devices to be tested to appear, and then click the drop-down button on the right side of "connect" and select the "Init Device" button.
After that, a window for phone initialization will pop up:
In this pop-up window, we can fill in the password required for installing the APK in advance. After that, click "Start Initialization", and the installation password will be automatically filled in for us during the installation of the APK (without manual handling). We can also not fill in the installation password and click "Start Initialization". In this way, when installing the apk, we need to manually enter the installation password to complete the installation of the corresponding apk (pocoservice.apk and Yosemite.apk).
2)Simple demonstration of initialization function.¶
Here we will briefly demonstrate the effect of the phone initialization function.
3)How to stop initialization¶
Click the "Stop Running" button to stop automatic initialization. The shortcut key is Shift+F5.
4)Results View¶
After the initialization is completed, all the settings of the brand will be displayed on the terminal, and the failed settings will also be listed. Some of the reasons for the failure may be that the device does not have the relevant settings, or that there is no need for these settings. In such cases, you can manually check and ignore them after verification. Some of the reasons are the pre-written rules do not include the relevant settings for this device. If you encounter this situation, you can provide us with the correct setting method for the corresponding device by submitting feedback to us at https://airtest.netease.com/issue_create. We will update the rules and relevant documents in a timely manner. Take the log of the initialization function as an example:
----------------------- * * * -----------------------
nan
Settings for OPPO phones:
- Connection Mode-Transfer Files
- [Manual setup required] Please log in to your OPPO account in advance.
- [Manual setup required] Developer Options activation method: Continuously tap [Settings-System Management-About Phone-Version Information-Software Version].
- Settings - Battery - App Power Management - pocoservice - Allow app auto-start, allow full background behavior.
- Settings - Other Settings - Developer Options-Disable Permission Monitoring, turn it on. Keep screen awake while charging, turn it on.
- Settings - Other Settings - Keyboard and Input Methods - Manage Input Methods - Enable Yosemite.
- Settings - Other Settings - Keyboard and Input Methods - Enable secure keyboard when entering password - Turn it off.
- Settings - Security & Privacy - Allow installation of apps from unknown sources. Turn it on. (not available on all devices)
[No settings needed] If there is a situation where OPPO phones disconnect after 10 minutes, do not unplug the phone. Instead, directly open USB debugging again in the dropdown options above the screen.
nan
Failed to set up the following steps:
nan
- Settings - Security and Privacy - Allow installation of apps from unknown sources. Turn it on.
(This option is not available on all devices.)
nan
nan
Error Reason:
Cannot find any visible node by query UIObjectProxy of "text=security and privacy"
We can check if each option on the phone has been correctly processed according to the options listed in the log. Possible reasons for the error:
- The phone does not have any relevant settings. Due to differences in phone models and versions, the settings can vary greatly even among phones of the same brand. If you cannot find certain options, you can ignore them.
- Some phones have the relevant options, but due to different models or system versions, our current rules have not been able to cover that phone. If this situation occurs, you can provide us with the phone model and corresponding settings for feedback.
- Some options are not mandatory. If left unhandled, the impact may be minimal and can be ignored depending on the situation (for example, options such as keeping the screen lit during charging or monitoring ADB installation of applications are not necessary and can be ignored).
- Almost all phones need to allow PocoService.apk to start in the background. Some phones may kill the Poco process in the background before making modifications, and manual handling may be required (such as OnePlus 8T).
4.Caution¶
1)Initialisation function¶
Check the phone image first and start initialization. Install PocoService.apk. This step may require manual installation confirmation or a password. Install Yosemite.apk. This step may also require manual confirmation. According to some settings of each brand, modify the settings in order. For some phones, the initialization may fail because PocoService has been automatically killed in the background by the phone. You can try to run it again or set it manually.
2)Supported Brands¶
The following are the currently supported brands:
- Samsung
- Huawei (including Honor)
- OPPO
- vivo
- OnePlus
- Realme
- Xiaomi
- Meizu
3)Related Settings¶
This function will disable many security-related options on the phone, mainly for the convenience of automated testing. If it is a phone for personal use, please read the list of configurations below and confirm that the content is correct before running.
Xiaomi phone (please make sure to log in to your account first and finish the settings in advance!!!!)¶
Xiaomi
-
[Manual Setting Required] Insert SIM card and log in to Xiaomi account (SIM card is required when you need to enable permissions on Xiaomi phones, SIM card can be removed after finishing the settings)
-
[Manual Setting Required] Enable developer options: click [Settings - My device - All parameters - MIUI version] repeatedly
- [Manual Setting Required] Set developer options: (Descriptions may vary depending on MIUI version) - Enable [USB debugging], [USB installation], [USB debugging (security settings) allow simulated clicks]
- Disable [Start MIUI optimization] and [Open high-risk function reminder] at the bottom of developer options
- Disable [Application permission monitoring] and [USB installation management] in Phone Manager-Application Management-Permissions-Settings in the upper right corner
- Enable Phone Manager-Application Management-Permissions-Autostart Management-PocoService, and allow PocoService to autostart - Language and input: Disable [Security keyboard], and enable [Yosemite input method] in input method management
- If the screen is still not visible on the phone, you can check if Yosemite.apk is successfully installed (you can install it manually) and corresponding permissions are enabled.
Huawei phone settings¶
!!! Tip: "Huawei" - [Manual Setting Required] USB mode to File. If "Only Charging" mode is enabled, debugging can only be done through direct connection. - Go to Settings -> Advanced Settings -> Language and Input -> Secure Input and turn it off (this option may have a different entry on different models). - Go to Settings -> Developer Options -> Monitor ADB Installation and turn it off. - Go to Settings -> Developer Options -> "Only Charging" mode allows ADB debugging and turn it on. - In the Mobile Manager (for versions greater than 8.0) -> App Startup Management -> Allow PocoService to start up and run in the background.
OPPO phone settings¶
OPPO
- [Manual Setting Required] Please log in to your OPPO account in advance
- Settings - Battery - App power usage management - pocoservice - Allow app to self-start, allow full background behavior - Settings - Other settings - Developer options - Disable permission monitoring
- Settings - Other settings - Keyboard and input method - Manage input method - Enable Yosemite
- Settings - Other settings - Keyboard and input method - Enable secure keyboard when entering passwords - Disable
- [Manual Setting] If the phone is disconnected for 10 minutes, do not unplug the phone. Instead, open USB debugging again from the options that appear when you swipe down from the top of the screen.
vivo phone settings¶
vivo
- [Manual Setting Required] Please log in to your VIVO account in advance
- [Manual Setting Required] Go to Settings - Developer Options - USB Debugging and turn it on (if available)
- Battery - High Power Consumption in Background -> Open PocoService
- Settings - Input Method - Turn off Security Input
- Developer Options - Turn on Security Permissions (not yet added)
- Settings - Security and Privacy - Turn off Prevent Malicious Screenshots and Screen Recordings
- Settings - More Settings (or System Management) - Developer Options -> Turn off Verify Apps via USB
- [Optional]Developer Options - Turn on Don't Lock Screen (this option can avoid the problem of the phone automatically turning off Developer Options when connected for a long time. If you need to connect for a long time, you can turn it on).
Samsung Phones¶
!!! Tip: "Samsung" - [Manual Setting Required] When connecting with a USB cable, allow access to phone data - [Manual Setting Required] Select installation of PocoService (If it's an international version, it may be detected by Google Play) - Settings-Display-Screen Resolution-WQHD+-Applications-Confirm, adjust the resolution to the maximum - [Not yet implemented] For some models of phones, in developer options, turn on unknown sources and disable permission monitoring.
Realme¶
Realme
- [Manual Setting Required] Please log in to your Realme account in advance.
- Go to Settings - Battery - App Power Consumption Management - PocoService - Allow app to start automatically and allow full background behavior.
- Go to Settings - Other Settings - Developer Options - Turn off permission monitoring (must), turn on screen not sleeping during charging (optional).
- Go to Settings - Other Settings - Keyboard and Input Method - Enable "Manage Input Method - Yosemite" and turn off "Use Secure Keyboard for Password Input".
OnePlus phone Settings¶
OnePlus
- [Manual Setting Required] Settings
- Battery - Battery optimization - PocoService - Do not optimize (The process may have been terminated by the phone before the setting is successful, so this option may need to be manually set)
- Settings - Other settings - Keyboard and input method - Enable secure keyboard when entering password - Turn it off - Settings - Other settings
- Keyboard and input method - Manage input method - Enable Yosemite input method
- Settings - Other settings - Developer options - Disable permission monitoring - Turn it on, Screen does not sleep when charging (optional).
Meizu phone Settings¶
!!! Tip: "Meizu" - Mobile Manager - Permission Management - Background Management - PocoService - Allow Background Running - Mobile Manager - USB Installation Management - USB Installation Management Uncheck, to avoid pop-up windows when installing APK - Settings - Language and Time - Yosemite Input Method Check, to cancel password security protection.