list disable package feature/component we can use pm list packages -d to list disabled packages.

but how can I list disabled feature/component inside a package?

for example I disable all fitness related stuff from gms

pm disable com.google.android.gms/.fitness.sync.FitnessSyncAdapterService
and so on

and I want to have an overview again which feature I have disabled
Not as straight-forward as listing packages. Here's an except (Bash code) on how my tool Adebar does it (for all apps on a device, spooling results to a file as pm disable comands in the way your question quotes it), to be found in lib/scriptgen.lib:


  local comps
  local myline
  scriptname="${OUTDIR}/deadReceivers.sh"
  echo "#!${BASH_LOCATION}" > "${scriptname}"
  echo -e "\n#\n# Disabled components for ${DEVICE_NAME} as of $(date '+%Y-%m-%d %H:%M')\n#" >> "${scriptname}"
  for pkg in $(adb ${ADBOPTS} shell "pm list packages 2>/dev/null"); do
    pkg=${pkg//[$'\t\r\n']}
    pkg=${pkg##*:}
    [[ "${pkg}" = "android" ]] && continue
    comps=$(adb ${ADBOPTS} shell "dumpsys package ${pkg}" | grep -E -A99999 "disabledComponents:" |grep -E -B99999 "enabledComponents:")
    if [[ -n "${comps}" ]]; then
      echo >> "${scriptname}"
      echo "# ${pkg}" >> "${scriptname}"
      for myline in $comps; do
        myline=${myline//[$'\t\r\n']}
        [[ "${myline}" = "disabledComponents:" || "${myline}" = "enabledComponents:" ]] && continue
        echo "adb ${ADBOPTS} shell \"pm disable ${pkg}/${myline}\"" >> "${scriptname}"
      done
    fi
  done


In short: You'd have to parse the "disabledComponents" section from the output of dumpsys package &lt;package_name&gt; ("comps" in above code fragment). As you can see, that segment is followed by a list of enabled components, in case you want to know where to find those.