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

Analyze AppComponentFactory

Usage From Android P/SDK 28, Android supports developers to use AppComponentFactory to delegate the default Service/BroadcastReceiver/ClassLoader/Activity/Application initialization. For example, we can use the following example to initialize the BroadcastReceiver with custom constructor: AndroidManifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <application android:appComponentFactory=".CustomAppCompFactory" ... tools:replace="android:appComponentFactory" tools:targetApi="31"> ... <receiver android:name=".CustomConstructorReceiver" android:exported="true"> <intent-filter> <action android:name="com.robolectric.CUSTOM_CONSTRUCTOR" /> </intent-filter> </receiver> </application> </manifest> CustomAppCompFactory.java: public class CustomAppCompFactory...

aospapp-component-factoryclassloading

Android Testing with Robolectric

Robolectric is the industry-standard local testing framework for Android. With Robolectric, your tests run in a simulated Android environment inside a JVM, without the overhead and flakiness of an emulator. At Android testing Fundamentals tutorial, Google gives a name for Robolectric: simulator. I have used it and contributed to it very much, and think it is very useful tool for...

robolectrictestingandroid

Analyze NativeActivity

NativeActivity is added to Android from API 9, and used for games and apps that write almost of all logic with native code. The NativeActivity is used to pass basic Android app’s lifecycle to native code, and help them to manage its logic with Android app lifecycle aware. There are also some glue code from NDK for NativeActivity and real...

aospnative-activityndk

Test uncompressed assets with Robolectric

This article is very short and just used to show how to test uncompressed assets with Robolectric. What we need do is very simple: Using Robolectric from 4.7(4.7.3 is the best recommended version currently with other big improvements). It contains changes to support opening fd from uncompressed file in apk. We can check Support to open fd for uncompressed file...

robolectrictestingassets

How Taskbar start app in freeform windowing mode

Taskbar is an awesome Android launcher which supports start app to freefrom windowing mode directly to provide desktop UI for Android user. And it is integrated into Android-x86 and BlissOS as alternative launcher to provide desktop experience for users. If you are not familiar with it, you can visit Taskbar’s Google Play Store page to download and experience it. This...

aosptaskbarfreeform

Show Maru container window to android-xserver

MaruOS is a project that leverages Android mobile phone’s computing unit to run Linux OS, especially Debian now, on Android OS with lxc. It uses its mflinger to allocate buffer from Android gralloc allocator, and then uses its mclient in Linux container to mmap this buffer and draw content from xf86-video-dummy to this buffer to show the Linux desktop to...

aospmaruosxserver

Use EXTRA_SETTINGS to split custom settings from official settings

If you are a ROM developer/maintainer, you maybe need to add some setting item to the official settings app for your custom configuration. For example, I need to add switch for user to enable/disable multi-window and BoringdroidSystemUI based on his/her need. If I add those switch to official settings app, I will manage the fork of official settings app, and...

aospsettingscustomization

[deprecated]Bliss OS: How to install Bliss OS on VirtualBox

The manual has been moved to Bliss Wiki, that will be maintained. This article is a draft content to describe how to install Bliss OS on VirtualBox. It combines android-x86 VirtualBox howto and Bliss OS Install Bliss OS on a VM (virtualbox) part. Create a new VM If you have not already created a VirtualBox virtual machine for Bliss OS...

bliss-osvirtualboxandroid-x86

Analyze picture in picture

This article based on AOSP 9.0. PIP is another multi-window feature I used very much when watching videos. This article will analyze its logic to show its details. Enter picture-in-picture(pip) We can enter pip by API Activity.enterPictureInPictureMode. If the activity supports pip, it will call ActivityManagerService.enterPictureInPictureMode to do the real work. ActivityManagerService.enterPictureInPictureMode // Adjust the source bounds by the insets...

aosppicture-in-picturemulti-window