Is Main/UI Thread same as System UI Thread in Android?

132
May 01, 2022, at 5:40 PM

This question is different than what's being discussed about Main thread and UI thread in Android.

By mean of System thread - the thread which handles system UI like statusbar, notifications & other ongoing system processes, say thread which handles home-button-press, recents-menu etc...

By mean of Main thread - App's thread which handles UI (forked when process launched)

I believe it's saperate thread as busy main thread of app is not hanging your device and all other than app things work fine.

My doubt is only for the purpose: If system can manage a separate thread for it self (to do UI work) than any process/app's-main thread; then why Apps can not have multiple threads who can handle UI (No matter how complex it's for devs!!)

Please provide references as well while pointing out answers on this.

Answer 1

By mean of System thread - the thread which handles system UI like statusbar, notifications & other ongoing system processes, say thread which handles home-button-press, recents-menu etc...

There may well be several threads involved in this.

I believe it's saperate thread as busy main thread of app is not hanging your device and all other than app things work fine.

More importantly, system UI is handled by separate OS processes, independent of the OS process for an app. As with most modern operating systems, in Android, a thread is owned by a process. Hence, by definition, separate processes have separate threads.

then why Apps can not have multiple threads who can handle UI (No matter how complex it's for devs!!)

That was an architectural decision, made close to 15 years ago, back when phone hardware was a lot more limited than it is today. Having a single "magic thread" is a common practice in constrained environments, as it avoids the overhead of constant checking for locks and other approaches to ensure thread-safety of data structures. While Google has done some things to try to improve on this (e.g., added a separate rendering thread), the core architectural limit remains, for backwards compatibility with older apps.

Also note that a fair amount of work is going into Jetpack Compose to try to allow for multi-threaded composables. Basically, since we now have a lot better hardware, Google is handling low-level synchronization for us in Compose, so composables can perhaps run on several threads without issue.

Rent Charter Buses Company
READ ALSO
how to automatic connect to device via Bluetooth and send file in flutter?

how to automatic connect to device via Bluetooth and send file in flutter?

how can write a program to connect nearly devices automatically via Bluetooth and send a file? just tried with FlutterBlue package but it doesn't work

122
Xamarin Dependency Services does not work with higher Android version

Xamarin Dependency Services does not work with higher Android version

I have programmed a Xamarin app that uses a native Android function through Dependency ServiceSpecifically it is about WifiManager and the method SetWifiEnabled() which is for turning off Wifi

90
Android Tv Nvidia Shield Pro crash after upgrading to SHIELD Experience Upgrade 9.0

Android Tv Nvidia Shield Pro crash after upgrading to SHIELD Experience Upgrade 9.0

I am facing an issue on my Android Tv app since Nvidia Shield Pro upgrade their firmware to SHIELD Experience Upgrade 90

76
What are all possible permissions taken by apps?

What are all possible permissions taken by apps?

There are two types of app permissions in case of android apps

140