Permission required android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE
And this permission can only be used by system app, so app needs system signature. Even if the non-system app is forced to be written in Android Mainfest.xml, it will also be written to /data/system/packages.xml during installation
Enable third-party app icons:
PackageManager pm = getPackageManager(); pm.setApplicationEnabledSetting(packageName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER, 0);
Disable third-party icons:
PackageManager pm = getPackageManager(); pm.setApplicationEnabledSetting(packageName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
If the app is disabled, the icon disappears from the desktop, otherwise, if enabled, the icon is displayed
Android disables third-party applications, and the corresponding source code
https://blog.csdn.net/xxooyc/article/details/50674333
Android app components are disabled, hibernated, frozen --- the use of packagemanager
http://blog.sina.com.cn/s/blog_7452896e0102w0lq.html