Analysis of input method abnormalities and application loss after Android OTA upgrade

During the Android development process, we may encounter various problems. Among them, the problems after OTA upgrade are particularly troublesome because they may be related to multiple factors. Because the same firmware only OTA will have certain problems that will make you doubt your life. This article will explore a specific problem: input method exceptions after OTA upgrade, and provide possible causes and solutions.

For the same version of firmware, there will be some abnormal bugs after wire brushing and OTA upgrade. I encountered this problem a long time ago when I had no habit of recording it. I encountered it again now, so I quickly recalled the reason and solved it.

-----0825 supplement starts-----


  1. Disappearance of preset applications :

    • When using Android.mkfiles and settings LOCAL_MODULE_PATH := $(TARGET_OUT)/preinstallto preset applications to preinstalla directory, I found that there is a probability that these applications will be lost after an OTA upgrade.
    • When set LOCAL_PRIVILEGED_MODULE := true(provisioned to system/priv-app), these apps can remain intact after OTA upgrades.

    Reasons and guesses :

    • The possible reason is that the OTA upgrade script does not correctly handle preinstallthe applications in the directory, causing them to be overwritten or deleted during the upgrade process.
    • The use LOCAL_PRIVILEGED_MODULEmay provide higher permissions or protection levels for the application so that it will not be affected by OTA upgrades.
  2. Latin input method fails :

    • Although the latin input method is pre-installed in system/appthe directory, it becomes unavailable after the OTA upgrade.
    • The specific manifestation is: /data/data/the corresponding application directory is missing in the directory.

    Reasons and guesses :

    • This may be because some application data was cleared during the OTA upgrade process, causing the latin input method to lose its necessary data files ( actually there is no com.android.inputmethod.latin in the /data/data/ directory ).
    • Another possibility is a permissions issue that prevents the latin input method from accessing its data directory after the OTA upgrade.

In addition, the reason why the input method and application cannot be used, I guess, is that there is a lag in the preinstall and /system/app part of the application in the Quanzhi platform system, and then the process is completed after the installation is not completed/complete? The current analysis is like this. I will have time to analyze later. Progress to be added


-----End of 0825 supplement-----

Problem Description

After OTA upgrade, I found that the input method does not take effect. The specific performance is:

  • Using settings get secure default_input_methodthe command returns empty.
  • In the Android Settings application, the preset input method is not visible in the input method options.
  • /data/data/You can see the input method data in the directory, but trying to manually set the default input method has no effect .

Comparative analysis

Through further testing and comparison, it was found that:

  • When using the same firmware for wire flashing, the input method works fine.
  • However, when upgrading through OTA, the above input method exception occurs.
    This difference indicates that the problem may be related to some specific steps or settings in the OTA upgrade process.

Reason guess

One major difference between OTA upgrades and wired flashes is that OTA upgrades usually do not clear /datapartitions, while wired flashes may. Therefore, we can guess that the cause of the problem may be:

  • OTA upgrade will not clear /datathe partition, causing some settings or configurations to be inconsistent or lost after OTA upgrade.
  • The default input method configuration is stored in /datathe partition. After OTA upgrade, the system may not be able to read or update these configurations correctly.

Solution

To solve this problem, consider reloading /data/system/users/0/settings_secure.xmlthe file every time the computer is powered on. This file stores the user's security settings, including the default input method. In this way, we can ensure that the default input method settings are updated correctly every time the computer is turned on.

The specific implementation method is to modify SettingsProvider.javathe file so that it is reloaded every time the computer is turned on settings_secure.xml.

+++ b/android/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -1858,9 +1858,9 @@ public class SettingsProvider extends ContentProvider {
    
    
             // Every user has secure settings and if no file we need to migrate.
             final int secureKey = makeKey(SETTINGS_TYPE_SECURE, userId);
             File secureFile = getSettingsFile(secureKey);
-            if (secureFile.exists()) {
    
    
+            /*if (secureFile.exists()) {
    
    
                 return;
-            }
+            }*/

Summarize

OTA upgrades are a complex process that may involve multiple system components and settings. When we encounter problems after OTA upgrade, detailed analysis and comparative testing are required to determine the cause of the problem and find a suitable solution. The abnormal input method problem discussed in this article is just one example. It reminds us that when performing OTA upgrades, we need to pay special attention to /datapartition processing to ensure the stability and functional integrity of the system. I also remind us that this modification method is not the most optimal. Good modification method. It is not ruled out that this modification method may cause abnormalities in other system settings (but I have not encountered any ^^).

Guess you like

Origin blog.csdn.net/SHH_1064994894/article/details/132470102