All modern devices that are coming into the market from the last six to seven years are touch screen based. While most of the Android devices especially the budget and the entry-level Android phones start to experience what’s known as a lag as years pass by. One of the most common issues that these user’s face are the responsiveness of the touchscreen becomes sluggish as months pass by, which results in lag. And many developers have been creating apps that promise to Boost Your Android’s touchscreen performance.
But not all of those apps work in real-world conditions because if the CPU is too busy performing other tasks and unable to handle any I/O operations, in this case, the touch input is given to your Android device. So, when it is unable to keep up with the I/O also known as interrupts operations that is touch inputs you see delays in the overall user interface.
But there are some ways to overcome this issue in this post we will discuss one such method that works and can improve your touchscreen responsiveness by at least 10 % to 15 % which is better than nothing or one or two percent that you get to see in some apps.
Before we dive into this method, your Android device should be rooted. And you also need to get familiar with some of the technical terms that we will be using to explain the following procedure so understand those terms, and accordingly, you need to make changes.
Might look difficult but there are just two to three steps which you need to follow and understand their technical aspects and how they will affect your smartphones responsiveness.
Table of Contents
Hardware interrupts on your CPU
Every time any smart computing machine whether it be a laptop PC or your Android phone. There are certain standard things that the CPU on all of these devices do, and those are executive hardware interrupts. This hardware interrupts are also known as operations input-output operations which interrupt the CPU from whatever it is doing and asks it to handle that executes this IO interrupts as they are the main priority here.
For example in a computer and IO operation is giving inputs from your keyboard mouse or by attaching external storage to your computer generates an IO input which the CPU has to process by stopping whatever it was doing currently. When it Encounters search hardware interrupts it executes a predefined code within the operating system that is in the case of the computer move the position of the pointer and in case of your Android device that touch input that you provide is taken here to interact with the user interface of Android.
So, when you provide multiple touch inputs and your device stops responding that means it is unable to keep up with those hardware interrupts.
It is a unique silicon/chip controller on your motherboard which is responsible for collecting all the interrupts and feeding it to the CPU. It can schedule interrupts and also give priority to certain interrupts over others by sending them to the other course of the CPU if your device has multiple CPU cores with most Android phones do.
Interrupt balancing on your CPU
The Kernel of your operating system by default allows the hardware interrupts or other IO operations only to the first CPU Core but as you know a single CPU Core can only perform a certain amount of a certain amount of operations within a given slice of time. So, if we can change the CPU’s nature to process these interrupts by assigning this interrupt services to a different CPU core maybe.
How to improve the Touch response to your Android phone
Step 1: As we discussed above, the interrupts are the one which if arrive in large numbers can and if the CPU is unable to handle them or keep up with the pace, you might experience lag. Now to fix this, we will assign the first to identify the interrupt, and as this is for Android smartphones, the I/O operation or the interrupt here is the Touch, means the touch driver.
Download and install the Android terminal emulator app on your smartphone, open a new window within it and run the following command:
Once you type the above mention command which shows us a list of interrupt controllers getting through the CPU as shown in the image above. We now need to find the Touch Interrupt in this huge list, it’s a tedious task, but it is necessary. This Touch driver will have the word Touch in it, that’s a small thing you need to consider when you start finding it.
Step 2: Once, you find that touch driver, you have to check them for the Interrupt number and remember it as it is needed for further operation. Note it down and then, type the following command. As shown in the image below.
In the above case specifically, the interrupt number for the Touch driver and it’s service was found to be 240(yours will vary as per the device), remember this number, because now comes the main part where we change the CPU’s affinity to handle these interrupts.
Step 3: In Linux, we can alter the CPU affinity via the /proc filesystem and to do so, you need that interrupt number that we searched above. Now run the following command in the terminal.
echo 1 > /proc/irq/240/smp_affinity_list
Now after this, let it execute and then close the terminal and remember do not reboot, as these changes won’t be in effect after a reboot. So, if you want these changes to stay, to avoid rebooting your device. Now if you’re an advanced user and want these changes to be applied every time at boot, you can flash the Init.d script file.