• Background Image

    News & Updates

January 31, 2019

How to decrease Android launcher RAM usage and improve performance

After some time using a launcher you could see its RAM usage to increase. People often ask us why this is happening and the answer is often related to the widgets added to the launcher and how they work.
An Android widget is a small piece of UI created by an app installed on your device that you can add to an Android launcher. What is not obvious is that even a simple widget can use an unexpected amount of RAM and that amount is considered, by the system monitor, as memory used by the launcher.

Take this example. Let’s consider an analog clock widget that you can easily find on Play Store. Most developers create the final picture using 3 different bitmaps with the same size. One for the clock face, one for the hour hand, one for the minute hand. The 3 bitmaps are usually created bigger than needed, this because the widget provider doesn’t know exactly the dimension of the widget, so it proposes something “big enough”. 

Let’s do some math. I have a 2×2 clock widget in an area of 400×400 pixels on a QHD device. The widget allocates 3 bitmaps with size 612×612. This means that tiny widget will use at least:
612x612x4x3=4494528 bytes = ~4.50MB
This is a real and very common case and is true for any analog clock widgets, or for widgets that include custom fonts. 

Of course, for a modern device 4.5MB is not a very important amount of memory, but it depends on how many widgets you use. If you consider that a single widget can use up to 22MB on a QHD device, you can understand that few memory intensive widgets can sensibly influence the amount of memory used by your launcher.

To help the users with this problem in Smart Launcher, we decide to include 2 built-in clock widgets that by being fully integrated into the launcher can be much more efficient than other widgets.

Also, widgets can negatively impact your launcher performance. In order to have optimal performances, Android engineers suggest keeping the number of views on screen as low as possible. A view is something like a text, an image or a piece of layout that has a specific behavior. A typical, complex Android app counts less 60 views per screen.

Guess what? the most popular calendar widget on Android is composed of over 2200 views! This means any part of code that performs a search in the view hierarchy will analyze 2200 more items than expected and will require much more time to perform the same task. If your launcher lags when you add many widgets, this could be the reason. 

However, this issue can be mitigated with an alternative Android launcher. In our Smart Launcher, we introduced some optimizations that allow the performance to not be affected by this kind of bad behavior. 

Should you stop using widgets? Probably not, but our suggestion is to not add to your home screen widgets you don’t really need and to try removing some widgets if you are not happy with your device performance.