SoFunction
Updated on 2025-04-12

Solve the problem of red frame flashing around Android screen

First, let’s analyze the problem:

In fact, this red box is not a bug of Android. Just change the compilation mode from eng to user. The red box only prompts you to busy when debugging the eng mode. The longer the red box, the longer the running of your system or application will stutter. At this time, the system may hang up, that's all!

The following is a detailed explanation of the improvement method:

Method 1: Directly compile to the usr version

If you are doing system porting, you can compile it into the USB version in Android/build. Of course, there are many permission problems during the development process of USB. The compiled system and eng permissions are a bit different. You need to pay attention to it when developing other application software.

Method 2: Modify the framework layer

Comment out(on) in the framework/base/services/java/com/android/server/wm/fileJust:

try { 
    // TODO(multi-display): support multiple displays 
    if (mStrictModeFlash == null) { 
        mStrictModeFlash = new StrictModeFlash(getDefaultDisplayContentLocked().getDisplay(), mFxSession); 
    } 
<span style="color:#cc0000;">    //(on);</span> 
} finally { 
    (); 
    if (SHOW_LIGHT_TRANSACTIONS)  
        (TAG,"<<< CLOSE TRANSACTION showStrictModeViolation"); 
} 

Method 3: Modify system configuration parameters

You can directly use the command to turn off the display:

setprop  0    (againstandroid 3.0) 
setprop  1    (againstandroid4.0) 

You can also directly modify the /system/ file and add the following two lines to restart:

=0  
=1 

I feel that the third one is the most convenient and will not change the Android framework code. After all, it is the accumulation of blood and sweat for many people, so I use the last method. Of course, no matter which method, as long as it can be solved, it will be OK.

The above is the problem of red boxes flashing around the Android screen introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!