[FAQ15097] Home button fails after OTA upgrade

[DESCRIPTION]

 After the OTA upgrade system, the Home button has feedback, but there is no corresponding function.

 

 

 

[SOLUTION]

 Please check whether the Provision.apk application is upgraded normally, and confirm that DEVICE_PROVISIONED in the settings database has been written as 1.

 

The role of Provision is very simple. It is a system initialization bootloader. In native Android, Provision only does one thing, which is to write a DEVICE_PROVISIONED tag. However, this mark is very useful. This mark will only be written once when the system is completely upgraded (double clear), which means that the Android system is ready to be upgraded and can work normally. The system may cause a problem without formatting the / data / partition (without double-clear operation), and the machine's Home button does not respond.

 

1. Provision program

  First of all, Provision is under the system source packages / apps. Let's take a look at the configuration of Provision:

    <application>
<activity android:name="DefaultActivity"                android:excludeFromRecents="true">            
<intent-filter android:priority="1">                
<action android:name="android.intent.action.MAIN" />                
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>        
</activity>    
</application>

  You can see two places from the code above,

First: Provision is configured with category.HOME property.

  Second: priority = 1, the priority is configured, that is to say, its priority is higher than our native Launcher priority, it will run before the Launcher starts.

public class DefaultActivity extends Activity {    
@Override    
protected void onCreate(Bundle icicle)     {        
super.onCreate(icicle);        
// Add a persistent setting to allow other apps to know the device has been provisioned.        Settings.Secure.putInt(getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 1);        
// remove this activity from the package manager.        
PackageManager pm = getPackageManager();        
ComponentName name = new ComponentName(this, DefaultActivity.class);        
pm.setComponentEnabledSetting(name, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);        
// terminate the activity.        
finish();    
}
}

 

 

The above is the full source code of Provision. Provision has only one Activity and mainly does two things:

  • Set DEVICE_PROVISIONED flag
  • Prohibit Provision's own Activity component

The entire Provision program only does these two things. DEVICE_PROVISIONED is the system upgrade flag we mentioned above.

 

2. Prohibit components

  The above mentioned one of the functions of Provision, write a mark. In addition to writing tags, there is a function that prohibits its own Activity component. First briefly introduce the API of prohibited components.

void setComponentEnabledSetting (ComponentName componentName, int newState, int flags)
  • componentName: component name 
  • newState: The new state of the component. Three values ​​can be set, as follows: 
  •   Unavailable state: COMPONENT_ENABLED_STATE_DISABLED 
  •   Available state: COMPONENT_ENABLED_STATE_ENABLED 
  •   Default state: COMPONENT_ENABLED_STATE_DEFAULT 
  • flags: Behavior label, the value can be DONT_KILL_APP or 0. 0 means kill the app containing the component

After disabling the component function, the package information of the system will be recorded, and the package information of the system is stored in /data/system/packages.xml

 

<package name="com.android.provision" codePath="/system/app/Provision.apk" nativeLibraryPath="/data/data/com.android.provision/lib" flags="1" ft="11b7e237e00" it="11b7e237e00" ut="11b7e237e00" version="15" userId="10005"><sigs count="1"><cert index="1" /></sigs><disabled-components><item name="com.android.provision.DefaultActivity" /></disabled-components></package>

   The above is to record the prohibited component information in the package. Of course, package.xml also contains all the information of the application package, you can take a look at this.

  This component will only run once, so if we do not format the / data directory, this component will be banned. So it will cause a problem that our DEVICE_PROVISIONED tag will not be written again.

  If you encounter the machine Home button does not work, you can check whether the DEVICE_PROVISIONED mark is normal.

Published 31 original articles · Likes6 · Visitors 10,000+

Guess you like

Origin blog.csdn.net/u012824529/article/details/102967349