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 window resizing

This article based on AOSP 9.0. We click the shadow of freeform window, and drag it to resize window. And this article will analyze window resizing logic to show how Android window handling resizing actions. Input flinger The InputDispatcher.cpp in input flinger will dispatch the input event to java part. For resizing, it will find the window which touchable region...

aospwindow-managermulti-window

Analyze AOSP input architecture

This article based on AOSP 9.0. This article is based on Jonathan Levin’s presentation about Android input architecture. It’s an excellent presentation for Android input architecture. The following diagrams are copied from presentation: The first diagram shows the Android input architecture from device to application, and the second diagram shows the Android input architecture from application to view. The following...

aospinputevent-dispatch

Analyze AOSP vsync model

This article based on AOSP 9.0. The Android UI rendering pipeline has following five stages: Application’s UI thread process input events, calls app’s callbacks, and updates the View hierarchy’s list of recorded drawing commands. Application’s RenderThread issues the recorded commands to the GPU. GPU draws the frame. SurfaceFlinger, which is the system service in charge of displaying the different application...

aospvsyncsurfaceflinger

Print call stack in AOSP native code

AOSP 9.0 Add libutilscallstack to your shared_libs of Android.bp. Add #include <utils/CallStack.h> to your c++ code. Add below code to the location you want to print call stack: android::CallStack callstack; callstack.update(); callstack.log("log-tag"); The following log is the example I use CallStack to print: 04-30 00:02:58.768 1569 1599 D enableVsyncLocked: #00 pc 000000000008de95 /system/lib64/libsurfaceflinger.so (android::impl::EventThread::threadMain()+981) 04-30 00:02:58.768 1569 1599 D enableVsyncLocked:...

aospnativedebugging

Analyze window shadow

This article based on AOSP 9.0. The Android uses Z value of view to calculate the view hierarchy, and shadow size of view. And the Z is the plus result of view’s elevation and view’s translation Z. So if we change any of them, and the final Z value of view will change. In frameworks, system uses elevation of view...

aospwindow-managerrendering

Analyze window size changing sequence

This article based on AOSP 9.0 It’s important to learn the changing sequence of window size from ActivityManager space to WindowManager space. This article will analyze this sequence to learn some important data structures of Android window system. ActivityManager space classDiagram class ActivityDisplay { -DisplayWindowController mWindowContainerController } class ActivityStack { -StackWindowController mWindowContainerController } class TaskRecord { -TaskWindowContainerController mWindowContainerController } class...

aospwindow-managermulti-window

Introduce SystemUI OverviewProxyService

This article based on AOSP 9.0 From AOSP 9.0, if we click the recents button in navigation bar, the Launcher3 will show its recents view, instead of SystemUI. In another word, from AOSP 9.0, the SystemUI provide a method to implement recents out the SystemUI. And if there is an another implementation, the SystemUI will use its fallback implementation. The...

aospsystemuioverview

Introduce SystemUI TunerService

This article based on AOSP 9.0 If you use pure AOSP built image, we can use following command to enable the TunerActivity: adb shell pm enable com.android.systemui/com.android.systemui.tuner.TunerActivity And then use following command to start the TunerActivity: adb shell am start com.android.systemui/.tuner.TunerActivity We can click the Navigation Bar to navigation bar tuner page, and click the Layout to the page to...

aospsystemuituner-service

Analyze Android ContextMenu

This article based on AOSP 9.0. ContextMenu is very useful UI item to show menu based on your event context, for example showing power menu around of power button when clicking it. This article will analyze the implementation of Android’s ContextMenu to provide information to implement custom floating context window. How to use ContextMenu The common use of ContextMenu is...

aospcontext-menuui