utzcoz's perosnal blog

Focus on AOSP, XR, and testing tools.

Working on open-source projects:Robolectric,boringdroid,MaruOS,DigitalisX64,aospbooks

Recent posts

42 total

Integrate Houdini to emulator

In x86 architecture device, we build the emulator with product target aosp_x86_64, which is the x86_64 architecture Android variant. So it can only run apks without so libraries and with x86 and x86_64 architecture variant libraries. But it can’t run apks with armhf architecture or arm64 architecture libraries. But if we can integrate Houdini to emulator, it will help emulator...

emulatorhoudiniarm-translation

Generate AOSP make build system products graph

The AOSP build system provides a make target called product-graph to generate products graph files. We can use below command to generate products graph files, products.dot, products.svg, products.pdf in out/ directory. make product-graph This is a sample generated sample: In latest master(2022.11), I found that product-graph doesn’t generate products.pdf and products.svg directly by calling dot command for us. And it...

aospmakefilebuild-system

Build AOSP for emulator

The emulator is good tool to test and prototype your product, and this article will show how to build it locally from your AOSP source code for your x86 architecture develop machine. The building commands are very simple, and we can use following commands to build emulator: source build/envsetup.sh lunch sdk_phone_x86_64-userdebug m emulator I have tested with target aosp_arm64, but...

aospemulatorbuild

Test LiveData in Instrumentation tests

The LiveData.observe method should run in main thread, but our test methods run in background thread, so we should use some tricks to avoid it if we want to test LiveData in Instrumentation tests. There is a method to use InstantTaskExecutorRule in library androidx.arch.core:core-testing to hook DefaultTaskExecutor to a normal TaskExecutor which pretends to run main thread. But it works...

androidlivedatainstrumentation

Exclude Android resource generated classes from Instrumentation target makefile

There are so many instrumentation tests created by Google in AOSP, and they will test basic function of app and ui function based on Activity. It works fine for many occasions, but it doesn’t process correctly, when your instrumentation target app uses third-part libraries with resources, and uses aapt flags to extra R for those packages. For example, maybe if...

aospmakefileinstrumentation

Compile adb for Android device

Actually, before Android 6.0, there is a adb in system/bin, which can be used in Android, and we can use this adb to connect itself or other Android device. But from Android 6.0, the Android official remove the build script for adb used in Android from system/core/adb/Android.mk because of the building problem. So, if you want to bring adb used...

androidadbbuild

Check whether the android is stable

This article based on Android 7.0, and it maybe obsolete. In WindowManagerService.java add a field: long mLastUpdateSurfaceRealTime = SystemClock.elapsedRealtime(); And then, in the last of WindowSurfacePlacer.java->performSurfacePlacementInner(boolean recoveringMemory) add below code: mService.mLastUpdateSurfaceRealTime = SystemClock.elapsedRealtime(); Lastly, add a method in WindowManagerService.java to check whether the android is stable: public boolean isSystemStable() { boolean isDisplayOk = okToDisplay(); boolean areAllAppsProcessed = mOpeningApps.size() == 0...

androidstabilitytesting

Just pause selenium for python

When I use selenium to test page, I just want to pause some seconds, and then to do some work. Firstly, I try to use time.sleep(seconds) of python, but the selenium will behaviour illegitimate. So I start to find solution from selenium. def just_wait(driver, seconds): try: WebDriverWait(driver, seconds).until( EC.presence_of_element_located( By.ID, 'fucking_selenium_pause_method' ) ) except Exception as e: print('Yes after %s...

seleniumpythonautomation

Transfer Redshift data between regions

Firstly, use aws’s UNLOAD command to save your redshift data to s3. UNLOAD('your select sql statement') TO 's3://bucketname/directory/file_prefix' ACCESS_KEY_ID 'aws_id' SECRET_ACCESS_KEY 'aws_key' ALLOWOVERWRITE ADDQUOTES ESCAPE PARALLEL OFF GZIP MANIFEST Above is just a unload template, just replace s3 location to save files which contains redshift data, aws key id and access key, also select command to select data what will...

awsredshiftcloud