I want to make a list of all user apps installed, and give the user the option to hide a app that he want. I have a rooted device, but when try to hide a selected app, gives me this error :
Permission Denial: attempt to change component state from pid=19832, uid=10158, package uid=10143.
This is the code i used to hide: input is the package name and xclass is the laucher activity
ComponentName componentToDisable =
new ComponentName(""+input,
""+xclass);
getPackageManager().setComponentEnabledSetting(
componentToDisable,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
Manifest permissions :
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.INJECT_EVENTS"
tools:ignore="ProtectedPermissions" />