Wednesday, March 16, 2016

applications - How to enable/disable apps using ADB (Android 8.x)?


I cannot get apps enabled or disabled using ADB.



  • Android: 8.0.0

  • Device: Samsung Galaxy A520 (SM-A520F)


I don't have root access to my device.


To get the list of the disabled packages I use:


$ adb shell pm list packages -d
package:com.samsung.android.game.gamehome

package:com.microsoft.skydrive
package:com.google.android.webview
package:com.google.android.videos
package:flipboard.boxer.app
package:com.samsung.android.ststub
package:com.sec.android.emergencylauncher
package:com.samsung.android.dlp.service
package:com.samsung.upsmtheme

Q1: Oddly, this list doesn't seem to include the apps I really disabled in the Apps section:




  • Briefing

  • Google Play Movies & TV


Why is that?


Then I run through the list and enable every package, e.g.:


$ adb shell pm enable com.google.android.webview
Package com.google.android.webview new state: enabled

Q2: Despite some packages are reported as "enabled" they are still in the disabled list:



$ adb shell pm list packages -d | grep com.google.android.webview
package:com.google.android.webview

Why is that?


Q3: How can I get the list of packages that I myself disabled in the Apps section and how can I manage this list using ADB?



Answer




Q1: Oddly, this list doesn't seem to include the apps I really disabled in the Apps section:





  • Briefing




  • Google Play Movies & TV




Why is that?



Your output already listed the two apps. com.google.android.videos for Google Play Movies and flipboard.boxer.app for Briefing app.


Optional: see my answer to know how to find an app's package name easily.



For your other issue:


This seems to be a problem in your ROM per se. My experiences with stock Android ROMs on Nexus 6 device and a near stock Android ROM on OnePlus 6 (Android 8.1.0) tell me this shouldn't happen.


Normally, the apps disabled using shell user are not listed in Settings app, but any app disabled by any means are listed in pm list packages -d or cmd package list packages -d.


Disabling and enabling an app without root access is simple. Run:


adb shell pm disable-user PACKAGE_NAME  # disables the app for the current user
adb shell pm enable PACKAGE_NAME # enables the app for the user, regardless of how the app was disabled.

No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...