text:
A way to automate the creation of flashable ZIPs
So, my question is: is there a way to automate the creation of flashable ZIP archives, in order to avoid having to write the updater-script and update-binary by myself each and every time I want a ZIP to be done?
Furthermore, the only feature the ZIP archives are required to do, is to install an application as system app. How could I perform such task, preferably without the aid of an external app?

Being unable to find something that matched my needs, I resolved to write a little script by myself. It's open to anyone which needs it.
#!/system/bin/sh

#This variable is used to calculate the time took by the various operations
#Altering it will result in badly calculated elapsed time
SECONDS=0

#This variable saves the path where the script resides
#DO NOT ALTER IT, or the whole script will fail with unpredictable errors
scriptDir="$(dirname "$(readlink -f "$0")")"

#This function verifies if there's at least an APK in the script's folder
#///Beginning of function "apkChecker"///
function apkChecker {
 echo "[INFO] Checking if at least an APK file is present..."
 if [ "$(ls "$scriptDir" | grep "\.apk$")" != "$(cat /dev/null)" ]; then
  echo "[INFO] At least one APK file has been found."
 else
  echo "[FATAL] No APK file found. Aborting."
  exit
 fi
}
#///End of function "apkChecker"///

#This function checks if the required tools (aapt and zip) are installed
#///Beginning of function "depencenciesChecker"///
function dependenciesChecker {
 echo "[INFO] Checking if both the aapt and zip utilities are installed..."

 whence -v aapt &> /dev/null
 isAaptAbsent="$(echo $?)"

 whence -v zip &> /dev/null
 isZipAbsent="$(echo $?)"

 case "$isAaptAbsent" in
  0)
   case "$isZipAbsent" in
    0)
     echo "[INFO] Both aapt and zip have been found."
     unset "isAaptAbsent" "isZipAbsent"
     ;;
    *)
     echo "[FATAL] zip cannot be found. Aborting."
     exit
     ;;
   esac
   ;;
  *)
   case "$isZipAbsent" in
    0)
     echo "[FATAL] aapt cannot be found. Aborting."
     exit
     ;;
    *)
     echo "[FATAL] Neither aapt nor zip can be found. Aborting."
     exit
     ;;
   esac
   ;;
 esac
}
#///End of function "dependenciesChecker"///

#This function relies on aapt, and is meant to retrieve the app's name from the given APK
#Notice that only the first APK in a list gets picked
#///Beginning of function "appNameRetriever"///
function appNameRetriever {
 echo "[INFO] Retrieving app name from the provided APK..."
 apkFile="$(ls "$scriptDir" | grep "\.apk$" | head -n 1)"
 appName="$(aapt d badging "$scriptDir"/"$apkFile")"
 appName="${appName#*application-label:\'}"
 appName="${appName//app*/}"
 appName="${appName%\'*}"
 displayedName=$appName
 appName="$(printf "%s" $appName)"
}
#///End of function "appNameRetriever"///

#This function creates the tree used by the ZIP (namely, the META-INF/com/google/android and appName folders)
#It also copies the previously picked APK to the appName folder, renaming it in the process
#///Beginning of function "folderTreeCreator"///
function folderTreeCreator {
 echo "[INFO] Creating ZIP folder tree and placing the APK to be flashed inside it..."
 mkdir -p ""$scriptDir"/$appName/META-INF/com/google/android"
 mkdir -p ""$scriptDir"/$appName/$appName"
 cp ""$scriptDir"/""$apkFile""" ""$scriptDir"/$appName/$appName/$appName.apk"
}
#///End of function "folderTreeCreator"///

#This function creates a dummy updater-script, which server mainly for aesthetical purposes
#///Beginning of function "updaterScriptCreator"///
function updaterScriptCreator {
 echo "[INFO] Creating dummy updater-script..."
 echo -n "#This is a dummy file. The magic is in the update-binary, which is a shell script." > ""$scriptDir"/$appName/META-INF/com/google/android/updater-script"
}
#///End of function "updaterScriptCreator"///

#=== BEGINNING OF "update-binary" WRITING SECTION ===
#From now on, the functions whose name begins with "sectionWriter", are used to assemble the update-binary

#This function writes the function and variables used for outputting things when flashing, to update-binary
#Thanks to Chainfire @ XDA, which seems to have been the first to implement them
#///Beginning of function "sectionWriter_header"///
function sectionWriter_header {
 echo "[INFO] Writing variables and functions prototypes to update-binary..."
 cat <<-EOF > ""$scriptDir"/$appName/META-INF/com/google/android/update-binary"
#!/sbin/sh

OUTFD=\$2
ZIP=\$3

ui_print() {
 echo -ne "ui_print \$1\n" > /proc/self/fd/\$OUTFD
 echo -ne "ui_print\n" > /proc/self/fd/\$OUTFD
}

EOF
}
#///End of function "sectionWriter_header"///

#This function writes the title of the ZIP (which contains the human-readable app name of the APK), to update-binary
#///Beginning of function "sectionWriter_zipName"///
function sectionWriter_zipName {
 echo "[INFO] Writing script title to update-binary..."
 cat << EOF >> ""$scriptDir"/$appName/META-INF/com/google/android/update-binary"
ui_print ""
ui_print "******************************"
ui_print " $displayedName Flashable ZIP "
ui_print " made by EDGAR, written by "
ui_print " Death Mask Salesman "
ui_print "******************************"
ui_print ""

EOF
}
#///End of function "sectionWriter_zipName"///

#This function writes the instructions necessary to mount the system partition in read-write mode, to update-binary
#///Beginning of function "sectionWriter_systemRwMount"///
function sectionWriter_systemRwMount {
 echo "[INFO] Writing mount instructions to update-binary..."
 cat << EOF >> ""$scriptDir"/$appName/META-INF/com/google/android/update-binary"
ui_print "~ Mounting /system in read-write mode..."
mount /system
mount -o remount,rw /system
ui_print ""

EOF
}
#///End of function "sectionWriter_systemRwMount"///

#This function writes the instructions to check for the Android version, to update-binary
#Notice that only JB, KK, LP and MM are supported, for now. That means a vast plethora of devices
#///Beginning of function "sectionWriter_osVersionChecker"///
function sectionWriter_osVersionChecker {
 echo "[INFO] Writing OS checking instructions to update-binary..."
 cat << EOF >> ""$scriptDir"/$appName/META-INF/com/google/android/update-binary"
ui_print "~ Checking Android version..."
androidVersion="\$(cat /system/build.prop | grep 'ro\.build\.version\.release')"
androidVersion="\${androidVersion#*=}"

case "\$androidVersion" in
 4.1*|4.1.*|4.2*|4.2.*|4.3*|4.3.*)
  ui_print "~ Android Jelly Bean (\$androidVersion) detected: proceeding."
  ;;
 4.4*|4.4.*)
  ui_print "~ Android KitKat (\$androidVersion) detected: proceeding."
  ;;
 5*|5.*|5.*.*)
  ui_print "~ Android Lollipop (\$androidVersion) detected: proceeding."
  ;;
 6*|6.*|6.*.*)
  ui_print "~ Android Marshmallow (\$androidVersion) detected: proceeding."
  ;;
 *)
  ui_print "~ Your Android version (\$androidVersion) is either obsolete or still unsupported."
  ui_print "~ Unmounting /system and aborting."
  umount /system
  exit
  ;;
esac

EOF
}
#///End of function "sectionWriter_osVersionChecker"///

#This function writes the instructions needed to unpack the ZIP to a temporary location, to update-binary
#This procedure is needed to obtain the APK to be installed as system app
#///Beginning of function "sectionWriter_zipUnpacker"///
function sectionWriter_zipUnpacker {
 echo "[INFO] Writing ZIP unpacking instructions to update-binary..."
 cat << EOF >> ""$scriptDir"/$appName/META-INF/com/google/android/update-binary"
ui_print "~ Extracting the ZIP to a temporary folder..."
mkdir -p "/tmp/$appName"
cd "/tmp/$appName"
unzip -o "\$ZIP"
ui_print ""

EOF
}
#///End of function "sectionWriter_zipUnpacker"///

#This function writes the bunch of instructions necessary to install the app as system, to update-binary
#As can be seen from the case-esac, almost each Android release has its specific install location
#///Beginning of function "sectionWriter_appInstaller"///
function sectionWriter_appInstaller {
 echo "[INFO] Writing APK installation instructions to update-binary..."
 cat << EOF >> ""$scriptDir"/$appName/META-INF/com/google/android/update-binary"
ui_print "~ Installing $displayedName..."

case "\$androidVersion" in
 4.1*|4.1.*|4.2*|4.2.*|4.3*|4.3.*)
  cp "/tmp/$appName/$appName/$appName.apk" "/system/app/"
  ;;
 4.4*|4.4.*)
  cp "/tmp/$appName/$appName/$appName.apk" "/system/priv-app/"
  ;;
 5*|5.*|5.*.*|6*|6.*|6.*.*)
  mkdir -p "/system/priv-app/$appName"
  cp "/tmp/$appName/$appName/$appName.apk" "/system/priv-app/$appName/"
  ;;
esac

ui_print "~ $displayedName has been installed."
ui_print ""

EOF
}
#///End of function "sectionWriter_appInstaller"///

#This function writes the instructions to change ownership, permissions and eventual SELinux context, to update-binary
#As for now, the script determines if SELinux is present by looking for the setenforce binary
#I'll probably base the check on the presence of "/sys/fs/selinux", but that has to be done in a next version
#///Beginning of function "sectionWriter_validateApp"///
function sectionWriter_validateApp {
 echo "[INFO] Writing APK ownership, permission and context change instructions to update-binary..."
 cat << EOF >> ""$scriptDir"/$appName/META-INF/com/google/android/update-binary"
case "\$androidVersion" in
 4.1*|4.2*|4.3*)
  ui_print "~ Setting ownership and permissions..."
  chown 0.0 "/system/app/$appName.apk"
  chmod 644 "/system/app/$appName.apk"
  if [ -e "/system/bin/setenforce" ]; then
   ui_print "~ Setting SELinux appropriate context..."
   chcon u:object_r:system_file:s0 "/system/app/$appName.apk"
  fi
  ;;
 4.4*)
  ui_print "~ Setting ownership and permissions..."
  chown 0.0 "/system/priv-app/$appName.apk"
  chmod 644 "/system/priv-app/$appName.apk"
  if [ -e "/system/bin/setenforce" ]; then
   ui_print "~ Setting SELinux appropriate context..."
   chcon u:object_r:system_file:s0 "/system/priv-app/$appName.apk"
  fi
  ;;
 5*|6*)
  ui_print "~ Setting ownership and permissions..."
  chown 0.0 "/system/priv-app/$appName"
  chmod 755 "/system/priv-app/$appName"
  chown 0.0 "/system/priv-app/$appName/$appName.apk"
  chmod 644 "/system/priv-app/$appName/$appName.apk"
  if [ -e "/system/bin/setenforce" ]; then
   ui_print "~ Setting SELinux appropriate context..."
   chcon u:object_r:system_file:s0 "/system/priv-app/$appName"
   chcon u:object_r:system_file:s0 "/system/priv-app/$appName/$appName.apk"
  fi
  ;;
esac
ui_print ""

EOF
}
#///End of function "sectionWriter_validateApp"///

#This function writes the instructions to unmount the system partition, to update-binary
#///Beginning of function "sectionWriter_systemUnmount"///
function sectionWriter_systemUnmount {
 echo "[INFO] Writing unmount instructions to update-binary..."
 cat << EOF >> ""$scriptDir"/$appName/META-INF/com/google/android/update-binary"
ui_print "~ Unmounting /system..."
umount /system
ui_print ""

EOF
}
#///End of function "sectionWriter_systemUnmount"///

#This function writes something as a termination/goodbye message, to update-binary
#///Beginning of function "sectionWriter_goodbyeString"///
function sectionWriter_goodbyeString {
 echo "[INFO] Writing goodbye message to update-binary..."
 echo "ui_print \"Installation completed! Have a great day!\"" >> ""$scriptDir"/$appName/META-INF/com/google/android/update-binary"
}
#///End of function "sectionWriter_goodbyeString"///

#=== END OF "update-binary" WRITING SECTION ===

#This function packs the META-INF and appName folders, thus creating the flashable ZIP
#DO NOT set a compression level of "0", or the produced ZIP will be corrupted
#///Beginning of function "zipPacker"///
function zipPacker {
 echo "[INFO] Packing the ZIP..."

 cd ""$scriptDir"/$appName"
 zip -qr9 $appName.zip *
}
#///End of function "zipPacker"///

#This function moves the compressed ZIP to the same directory of the script, and wipes the directories created by "folderTreeCreator", along with their content
#///Beginning of function "cleanup"///
function cleanup {
 echo "[INFO] Moving the flashable ZIP to "$scriptDir"..."
 mv ""$scriptDir"/$appName/$appName.zip" "$scriptDir"

 echo "[INFO] Cleaning up the folders used as ZIP base..."
 rm -rf ""$scriptDir"/$appName"
}
#///End of function "cleanup"///

#This is the core of the EDGAR tool
#Here, all of the previously defined functions are called in the correct order
#To add a function, and thus extend EDGAR's versatility, simply define it above, and call it below
#///Beginning of EDGAR's core///
echo "**************************************"
echo " EDGAR - Flashable ZIP creator script "
echo "    by    Death    Mask    Salesman   "
echo "**************************************"
echo ""

apkChecker
echo ""

dependenciesChecker
echo ""

appNameRetriever
echo ""

folderTreeCreator
echo ""

updaterScriptCreator
echo ""

sectionWriter_header
sectionWriter_zipName
sectionWriter_systemRwMount
sectionWriter_osVersionChecker
sectionWriter_zipUnpacker
sectionWriter_appInstaller
sectionWriter_validateApp
sectionWriter_systemUnmount
sectionWriter_goodbyeString
echo ""

zipPacker
echo ""

cleanup
echo ""

echo "[INFO] Operations took "$(((SECONDS/60)/60))" hours, "$(((SECONDS/60)%60))" minutes and "$((SECONDS%60))" seconds."
echo "[INFO] All done!"
#///End of EDGAR's core///

Why did you make this a wiki? Do you realize that its content is opened to alteration?

@Firelord I do realize it fully. I decided to make it a wiki because I would like users to add their own modifications (should them be needed), fixes et similia. Secondly, it's not fair for me to steal reputation for something I coded and published by exploiting a loophole in the rules, even if it may be useful to others.

@DeathMaskSalesman It's not really about stealing reputation. The reputation is just a reward for good efforts you have made. If you want someone to correct or improve script, they can edit normally. It would most probably get approved anyway

@DeathMaskSalesman can you explain more about how to use this please?  I don't understand where it runs and how it's used? Can you provide an example of its use please? (from the shebang path I guess it runs on an Android device?) Also, does it cater for multiple .apk packages and does it cater for such packages that contain native libraries?

@starfry It is to be ran from a rooted Android device. Assume that its location is the root directory of the internal storage. You will need to place your APK of choice in the same directory of the script, then open a Terminal and issue su. Next, cd to /data/media/0, assign the correct permissions with chmod 777 ./script_name.sh, where script_name is the name you assigned to a file with the content in this answer. To successfully build a flashable ZIP, your device will need to have both the aapt and zip binaries installed. Once the conditions are met, run the script...

@starfry ... with ./script_name.sh. The script (EDGAR) will create the structure of the flashable ZIP, write the updater-script and the update-binary, copy the APK in the appropriate folder of the ZIP, compress the actual ZIP and move it to the script's directory and wipe the raw folders it created in the process. The script can (as of now) create flashable ZIPs of standalone APK files; no libraries. The ZIP per se may be flashed on Android devices from 4.1.x to 6.0.x (could not test Android N): its update-binary will take care of all the permissions and SELinux contexts.

Well that worked first time! I'm going to take a litle time to understand it and then hopefully produce a version that handles multiple ZIPS and installs any libraries in the correct place. I'll let you know how I get on.

@starfry Glad it worked, and please keep me updated about your progress. Maybe I'll rewrite this one, in the meantime.

@DeathMaskSalesman I have it running on Linux (once I got aapt installed). Only change was to shebang (/bin/sh) and to use which instead of whence. Tomorrow I will try to make it multi-package but that's enough for today!

I have taken the script by @DeathMaskSalesman and augmented it so that it produces a ZIP containing all .apk packages found in the current directory and installs both those packages as well as the libraries contained therein.
#!/bin/sh
#!/system/bin/sh
# Swap the above two lines as appropriate: Linux: /bin/sh; Android: /system/bin/sh
#http://android.stackexchange.com/questions/143304

#This variable is used to calculate the time took by the various operations
#Altering it will result in badly calculated elapsed time
SECONDS=0

#This variable saves the path where the script resides
#DO NOT ALTER IT, or the whole script will fail with unpredictable errors
scriptDir="$(dirname "$(readlink -f "$0")")"

# This defines the name of the created ZIP
ZIPFILE="$scriptDir/edgar.zip"

# This defines the name of the temporary directory where
# the ZIP structure will be built
ZIPDIR="$ZIPFILE.dir"

rm -rf "$ZIPDIR" "$ZIPFILE" # Uncomment to automatically remove pre-existing ZIP

#This defines the path to the update-binary within the ZIPDIR
UPDATE_BINARY="$ZIPDIR/META-INF/com/google/android/update-binary"

#Helper function to abort: prints fatal error message and exits
abort() { echo '[FATAL] '$*; exit 1; }

#Aborts unless listed dependencies are satisfied
depend() {
  for dep in "$@"
  do
    which "${dep}" &> /dev/null || \
      abort 'Missing dependency '${dep}' (required: '$@')'
  done
}

#This function relies on aapt, and is meant to retrieve the app's name from the given APK
#///Beginning of function "appNameRetriever"///
#Sets globals $displayedName to the app name with whitespace intact
#             $appName to the app name with whitespace removed
#             $apkFile to the path passed in as $1
function appNameRetriever {
 echo "[INFO] Retrieving app name from $1..."
 apkFile="$1"
 appName="$(aapt d badging "$apkFile")"
 appName="${appName#*application-label:\'}"
 appName="${appName//app*/}"
 appName="${appName%\'*}"
 displayedName=$appName
 appName="$(printf "%s" $appName)"
}
#///End of function "appNameRetriever"///

#This function creates the directory structure required inside ZIP
init() {
  [[ -e "$1" ]] && abort "Cannot initialize '$1'; already exists"
  echo "[INFO] Initializing ZIP structure..."
  mkdir -p "$ZIPDIR/META-INF/com/google/android"
}
#///End of function "folderTreeCreator"///

add_apk() {
 echo "[INFO] Adding $appName..."
 mkdir -p "$ZIPDIR/$appName"
 cp "$apkFile" "$ZIPDIR/$appName/$appName.apk"
}

#This function creates a dummy updater-script, which serves mainly for aesthetical purposes
#///Beginning of function "updaterScriptCreator"///
function updaterScriptCreator {
 echo "[INFO] Creating dummy updater-script..."
 echo -n "#This is a dummy file. The magic is in the update-binary, which is a shell script." > "$ZIPDIR/META-INF/com/google/android/updater-script"
}
#///End of function "updaterScriptCreator"///

#=== BEGINNING OF "update-binary" WRITING SECTION ===
#From now on, the functions whose name begins with "sectionWriter", are used to assemble the update-binary

#This function writes the function and variables used for outputting things when flashing, to update-binary
#Thanks to Chainfire @ XDA, which seems to have been the first to implement them
#///Beginning of function "sectionWriter_header"///
function sectionWriter_header {
 echo "[INFO] Writing variables and function prototypes to update-binary..."
 cat <<-EOF > "$ZIPDIR/META-INF/com/google/android/update-binary"
#!/sbin/sh

OUTFD=\$2
ZIP=\$3

ui_print() {
 echo -ne "ui_print \$1\n" > /proc/self/fd/\$OUTFD
 echo -ne "ui_print\n" > /proc/self/fd/\$OUTFD
}

get_buildprop() {
 prop=\$(grep "\${1//./\\.}=" /system/build.prop)
 echo "\${prop#*=}"
}

ui_print ""
ui_print "******************************"
ui_print " APK Flashable ZIP "
ui_print " made by EDGAR, written by "
ui_print " Death Mask Salesman "
ui_print "******************************"
ui_print ""
EOF
}
#///End of function "sectionWriter_header"///

#This function writes the title of the app (which contains the human-readable app name of the APK), to update-binary
#///Beginning of function "sectionWriter_zipName"///
function sectionWriter_appName {
 echo "[INFO] Writing script title to update-binary..."
 cat << EOF >> "$ZIPDIR/META-INF/com/google/android/update-binary"
ui_print ""
ui_print "******************************"

EOF
}
#///End of function "sectionWriter_zipName"///

#This function writes the instructions necessary to mount the system partition in read-write mode, to update-binary
#///Beginning of function "sectionWriter_systemRwMount"///
function sectionWriter_systemRwMount {
 echo "[INFO] Writing mount instructions to update-binary..."
 cat << EOF >> "$ZIPDIR/META-INF/com/google/android/update-binary"
ui_print "~ Mounting /system in read-write mode..."
mount /system
mount -o remount,rw /system
ui_print ""

EOF
}
#///End of function "sectionWriter_systemRwMount"///

#This function writes the instructions to check for the Android version, to update-binary
#Notice that only JB, KK, LP and MM are supported, for now. That means a vast plethora of devices
#///Beginning of function "sectionWriter_osVersionChecker"///
function sectionWriter_osVersionChecker {
 echo "[INFO] Writing OS checking instructions to update-binary..."
 cat << EOF >> "$ZIPDIR/META-INF/com/google/android/update-binary"
ui_print "~ Checking Android version..."
androidVersion="\$(get_buildprop 'ro.build.version.release')"

case "\$androidVersion" in
 4.1*|4.1.*|4.2*|4.2.*|4.3*|4.3.*)
  ui_print "~ Android Jelly Bean (\$androidVersion) detected: proceeding."
  ;;
 4.4*|4.4.*)
  ui_print "~ Android KitKat (\$androidVersion) detected: proceeding."
  ;;
 5*|5.*|5.*.*)
  ui_print "~ Android Lollipop (\$androidVersion) detected: proceeding."
  ;;
 6*|6.*|6.*.*)
  ui_print "~ Android Marshmallow (\$androidVersion) detected: proceeding."
  ;;
 *)
  ui_print "~ Your Android version (\$androidVersion) is either obsolete or still unsupported."
  ui_print "~ Unmounting /system and aborting."
  umount /system
  ;;
esac

EOF
}
#///End of function "sectionWriter_osVersionChecker"///

#This function gets the list of supported ABI versions (CPU Architecture)
#in increasing order of preference
#///Beginning of function "sectionWriter_getAbiList
function sectionWriter_getAbiList {
  echo "[INFO] Writing getAbi instructions to update-binary..."
  cat << EOF >> "$UPDATE_BINARY"
ui_print "~ Getting supported ABIs..."

reverse() {
  if [ "\$#" -gt 0 ]; then
    local arg=\$1
    shift
    reverse "\$@"
    echo -n "\$arg "
  fi
}

androidAbiList="\$(get_buildprop 'ro.product.cpu.abilist')"
androidAbiList="\${androidAbiList//,/ }"
if [[ -n "\$androidAbiList" ]]
then
  androidAbiList="\$(reverse \$androidAbiList)"
else
  androidAbi="\$(get_buildprop 'ro.product.cpu.abi')"
  androidAbi2="\$(get_buildprop 'ro.product.cpu.abi2')"
  androidAbiList="\$androidAbi2 \$androidAbi"
fi

ui_print "~ Supported ABIs: \$androidAbiList"

EOF
}
#///End of function "sectionWriter_osVersionChecker"///

#This function writes the bunch of instructions necessary to install the app as system, to update-binary
#As can be seen from the case-esac, almost each Android release has its specific install location
#///Beginning of function "sectionWriter_apkInstaller"///
function sectionWriter_apkInstaller {
 echo "[INFO] Writing APK installation instructions to update-binary..."
 cat << EOF >> "$ZIPDIR/META-INF/com/google/android/update-binary"
ui_print "~ Installing $displayedName..."

case "\$androidVersion" in
 4.1*|4.1.*|4.2*|4.2.*|4.3*|4.3.*)
  unzip -qo "\$ZIP" '$appName/$appName.apk' -d '/system/app/'
  ;;
 4.4*|4.4.*)
  unzip -qo "\$ZIP" '$appName/$appName.apk' -d '/system/priv-app/'
  ;;
 5*|5.*|5.*.*|6*|6.*|6.*.*)
  unzip -qo "\$ZIP" '$appName/*' -d '/system/priv-app'
  ;;
esac

ui_print "~ $displayedName has been installed."
ui_print ""

EOF
}
#///End of function "sectionWriter_apkInstaller"///

#This function writes instructions to update-binary to install any libs in the apk
#As can be seen from the case-esac, almost each Android release has its specific install location
#///Beginning of function "sectionWriter_libInstaller"///
function sectionWriter_libInstaller {
 echo "[INFO] Writing library installation instructions to update-binary..."
 cat << EOF >> "$ZIPDIR/META-INF/com/google/android/update-binary"
ui_print "~ Installing $displayedName libraries..."

case "\$androidVersion" in
 4.1*|4.1.*|4.2*|4.2.*|4.3*|4.3.*|4.4*|4.4.*)
  apkFile='/system/app/$appName/$appName.apk'
  ;;
 5*|5.*|5.*.*|6*|6.*|6.*.*)
  apkFile='/system/priv-app/$appName/$appName.apk'
  ;;
esac

unzip -qo "\$apkFile" 'lib/*'
for abi in \$androidAbiList
do
  if [[ -d "lib/\$abi" ]]
  then
    ui_print "~ \$abi..."
    mv lib/\$abi/* '/system/vendor/lib'
  fi
done
rm -rf lib

ui_print "~ $displayedName libs have been installed."
ui_print ""

EOF
}
#///End of function "sectionWriter_libInstaller"///

#This function writes the instructions to change ownership, permissions and eventual SELinux context, to update-binary
#As for now, the script determines if SELinux is present by looking for the setenforce binary
#I'll probably base the check on the presence of "/sys/fs/selinux", but that has to be done in a next version
#///Beginning of function "sectionWriter_validateApp"///
function sectionWriter_validateApp {
 echo "[INFO] Writing APK ownership, permission and context change instructions to update-binary..."
 cat << EOF >> "$ZIPDIR/META-INF/com/google/android/update-binary"
case "\$androidVersion" in
 4.1*|4.2*|4.3*)
  ui_print "~ Setting ownership and permissions..."
  chown 0.0 "/system/app/$appName.apk"
  chmod 644 "/system/app/$appName.apk"
  if [ -e "/system/bin/setenforce" ]; then
   ui_print "~ Setting SELinux appropriate context..."
   chcon u:object_r:system_file:s0 "/system/app/$appName.apk"
  fi
  ;;
 4.4*)
  ui_print "~ Setting ownership and permissions..."
  chown 0.0 "/system/priv-app/$appName.apk"
  chmod 644 "/system/priv-app/$appName.apk"
  if [ -e "/system/bin/setenforce" ]; then
   ui_print "~ Setting SELinux appropriate context..."
   chcon u:object_r:system_file:s0 "/system/priv-app/$appName.apk"
  fi
  ;;
 5*|6*)
  ui_print "~ Setting ownership and permissions..."
  chown 0.0 "/system/priv-app/$appName"
  chmod 755 "/system/priv-app/$appName"
  chown 0.0 "/system/priv-app/$appName/$appName.apk"
  chmod 644 "/system/priv-app/$appName/$appName.apk"
  if [ -e "/system/bin/setenforce" ]; then
   ui_print "~ Setting SELinux appropriate context..."
   chcon u:object_r:system_file:s0 "/system/priv-app/$appName"
   chcon u:object_r:system_file:s0 "/system/priv-app/$appName/$appName.apk"
  fi
  ;;
esac
ui_print ""

EOF
}
#///End of function "sectionWriter_validateApp"///

#This function writes the instructions to unmount the system partition, to update-binary
#///Beginning of function "sectionWriter_systemUnmount"///
function sectionWriter_systemUnmount {
 echo "[INFO] Writing unmount instructions to update-binary..."
 cat << EOF >> "$UPDATE_BINARY"
ui_print "~ Unmounting /system..."
umount /system
ui_print ""

EOF
}
#///End of function "sectionWriter_systemUnmount"///

#This function writes something as a termination/goodbye message, to update-binary
#///Beginning of function "sectionWriter_goodbyeString"///
function sectionWriter_goodbyeString {
 echo "[INFO] Writing goodbye message to update-binary..."
 echo "ui_print \"Installation completed! Have a great day!\"" >> "$UPDATE_BINARY"
}
#///End of function "sectionWriter_goodbyeString"///

#=== END OF "update-binary" WRITING SECTION ===

#This function packs the prepared ZIP directory and
#removes it, leaving behind the flashable ZIP
#DO NOT set a compression level of "0", or the produced ZIP will be corrupted
#///Beginning of function "zipPacker"///
function zipPacker {
 echo "[INFO] Packing the ZIP..."

 OLDPWD=$(pwd)
 cd "$ZIPDIR"
 zip -qr9 "$ZIPFILE" .
 cd "$OLDPWD"
 rm -rf "$ZIPDIR"
}
#///End of function "zipPacker"///

#This is the core of the EDGAR tool
#Here, all of the previously defined functions are called in the correct order
#To add a function, and thus extend EDGAR's versatility, simply define it above, and call it below
#///Beginning of EDGAR's core///
echo "**************************************"
echo " EDGAR - Flashable ZIP creator script "
echo "    by    Death    Mask    Salesman   "
echo "**************************************"
echo ""

depend aapt zip find
echo ""

init "$ZIPDIR"
echo ""

updaterScriptCreator
echo ""

sectionWriter_header
sectionWriter_systemRwMount
sectionWriter_osVersionChecker
sectionWriter_getAbiList

for appName in $( find "$scriptDir" -maxdepth 1 -type f -name '*.apk' )
do
  appNameRetriever "$appName"
  sectionWriter_appName
  add_apk
  sectionWriter_apkInstaller
  sectionWriter_libInstaller
  sectionWriter_validateApp
done

sectionWriter_systemUnmount
sectionWriter_goodbyeString
echo ""

zipPacker
echo ""

echo "[INFO] Operations took "$(((SECONDS/60)/60))" hours, "$(((SECONDS/60)%60))" minutes and "$((SECONDS%60))" seconds."
echo "[INFO] All done!"
#///End of EDGAR's core///

Some points

The script runs on my Android Lollipop and on Linux. I haven't been able to test on other Android versions.
I have only tested flashing the generated ZIP using FlashFire.
It installs libraries for the ABI that the Android system reports as valid. Where there are multiple it installs all of them from the least preferable to the most preferable (so the latter overwrites the former).

I am just learning about the internals of Android and I may have done some things incorrectly, so bear that in mind when looking at the script. I think the script could do with some cleaning up but I just wanted to get it out there for @DeathMaskSalesman to take a look at.

Seems pretty good, I'd say. I'll test it when my other script, NEMRIS, will be the way I want it! And kudos for making it runnable under Linux with minimal effort.

Hi @DeathMaskSalesman, I have made some amendments to my script to support installs to both /system/app and /system/priv-app and to support injection of custom commands around the install (for example, to wipe unwanted stock apps). I've pushed my latest version  onto GitHub


text:
Nexus 6P wrong time
Whilst in my pocket, I have pulled out my Nexus 6P and found it has rebooted (at least this is what I assume as it now wants my full passcode and will not allow unlock with fingerprint).
I also find that the time is wrong. It has reset back to 1st Jan 1970 12am. I have not been able to get it to correct itself (via my network - EE in UK if that matters).
The only fix has been to disable automatic time sync, manually set it, and then re-enable auto time sync.
How can I get this to auto rectify the issue next time it happens? Its very annoying!
I am fully up-to-date with all software and patches.

usually this happens when a non system app tries to get date before system connects to network after a flash or reboot(always happens with whatsapp).Hence manual checking/unchecking or re-reboot works. try to stop apps staring at boot.

If this keeps repeating it may probably be an firmware level problem. In that case you can try flashing the Nexus 6p ROM image available from Google Android site(provided your phone's bootloader is unlocked) .
There is a fair chance of it being a hardware issue as well. If so, better get it checked from an authorized service center. Even if it is just a software glitch, if your phone is under warranty and you haven't unlocked /rooted it, take it to the service guys. That way your warranty won't get void

Thanks for the response. Hasn't happened since I posted that, so I'll wait until the next incident. I am also having serious on/off performance issues that may be related so I will look to get that resolved too.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Android Studio (Windows 7) does not detect ASUS Zenfone. Cannot run my app
So, I will list the problems one by one. Please help.

I plug phone into laptop's USB using Phone's own data/ charger cable. Everything is ok. Phone is in MTP mode.
Android Studio does not detect the phone when I try to run my app.
Device Manager shows an exclamation mark on ADB Interface, but my ASUS is connected as a portable device. (I downloaded the exact drivers for the phone, however, manually trying to select those driver to update the ADB interface fails)
ADB Wireless (No Root) is installed on phone, but my computer fails to do a detection with the adb commands: devices, tcpip 5555, and usb, giving the message Error: device not found.
As some solutions suggested, switching to PTP mode does not help either.
The ASUS phone always wants to install a Share Link software when it's connected. Is this what is blocking a simple USB data connection?

Question: What might be the problem, and the workaround?

as per asus site https://www.asus.com/support/faq/1007320 you should use asus PC link for debugging. As a general rule 'USB Debugging" should be enabled for ADB to work. Try using latest adb installed away from your sdk.

You need to turn on the USB debugging for ADB to work.
To turn on USB debugging:
Navigate to Settings > About Phone > scroll to the bottom > tap Build number seven 7 times. You'll get toast saying that you're now a developer. 2. Go back and now you can see  the Developer options in settings, check 'USB debugging' and click OK.
Some times you may need to install drivers for your phone. You can download it from manufactures website.

Sometimes when the phone driver does not install try using http://pdanet.co/a/ Install the app when the phone is connected to the laptop. Even if the installation fails for some reason you still might get the driver for the phone ins

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Does the Samsung Galaxy 5 support Band 12 LTE?
Does the Samsung Galaxy 5 support Band 12 with AOSP/CM13?

No, it doesn't have the hardware
Here is the T-Mobile spec sheet for the Galaxy S5 that seems to indicate it doesn't support Band 12.
Network
2G/3G/4G/LTE Capable
UMTS: Band V (850); UMTS/HSPA+: AWS Band IV / 2100 / 1900 / 850;Band II (1900);Quad Band GSM;LTE
  GSM/GPRS/EDGE: 850/900/1800/1900MHz

And, here is the Spec Sheet from Samsung that seems to indicate it doesn't support Band 12,
Network
FREQUENCIES AND DATA TYPE
LTE: Bands 1/2/3/5/7/8/4/17 HSPA+/UMTS: 850/AWS/1900/2100MHz GSM: 850/900/1800/1900MHz


text:
Help! Lg v10 OS update erased entire calendar
All past events, all scheduled events, gone. Also, google calendar is not available in list of calendars to sync/enable. It's not that I just failed to check a box, it's that it isn't even listed as an option to choose.
Searched for hours for reports of similar problems with solutions, found nothing. Well, I found lots of other people who also lost entire calendars, but none with solutions that worked.
Absolutely nothing I have tried has helped: reboots, resets, adding/deleting accounts, etc.
Really, what good is a "smart" phone that won't keep a basic calendar? How many people absolutely REQUIRE an adequate appointment/schedule app on their devices?
I hated my iphone, but I'll tell ya - it never deleted a single calendar event without me expressly telling it to do so... For that matter, neither did my ancient blackberry...
Not sure whether this is an Android issue or an Lg v10 issue, but outrageously expensive phones should not be this much hassle.

Perhaps it's a bug with LG that they fixed in this update. Apart from that, do you get to chose where to store calendar data? If you can, then I would recommend storing it on the SD Card

"google calendar not available in the list of apps". what does this mean?if the calendar app is not there in app 'drawer' how you know everything is gone? also you didnt mention  that you checked your google account on a PC/Laptop and it shows nothing there.


text:
Automatically enable/disable data mobile
Mobile data have enabled all the time drastically reduces the battery, is there any way to automatically turn on mobile data for 5min and then turn off this each (~)1 hour?

An [tag:automation] app can do this fairly easily (for Android 5+, root access would be needed) but your objective is not sketched out clearly.

If you want a solution using automation (MacroDroid) I can suggest

As Firelord mentioned, you would need to add details to present requirements fully

To my knowledge, there're no native settings in Android to achieve that. But there are several "battery savers" doing exactly that, which I call Data Stutterer.
One candidate holding the top of the list for a long time was JuiceDefender, which unfortunately got its last update in 2012. GreenPower is still updated, and offers the same functionality:

JuiceDefender and GreenPower (source: Google Play; click images for larger variants)
There are other comparable apps out there. If you want a good app recommendation, please ask for that at our sister site after having read Where to ask for app recommendations? (SR has quite strict rules, so make sure your question there has all required details).


text:
Icon packs on stock Huawei Launcher
Is there any way to use icon packs on the stock launcher in the same way they can be used on third-party launchers? I have a Huawei P8; it is rooted so I'm guessing there is a way but my searches have come up empty so far.

Can you clarify your question a bit? What were you trying to accomplish, I'm sure the icons are store in the theme file (.hwt). You can decompress the file by simply renaming it to a .zip and extract the png of the icons


text:
What is this lock screen with ads and how do I remove it?
I think my device got a malware. A lock screen with ads sometimes appear, and I must swipe an area at the bottom of the screen to open the phone. I am in Eastern Europe, some ads are in Slavic languages, and they are seemingly related to travel.

Image resized. Click to view the full image
I have seen ads for Lot Air (Polish carrier). I recently went to their site.
Considering my recent surfing activity and the nature of the ads, I guess the malware is connected to airlines active in Eastern Europe.
The lock screen also promotes the app "DU Quick Charger" by claiming it has recharged the phone extra fast during screen off. (!?) It also shows battery level. I have never installed DU Quick Charger. I doubt DU Quick Charger is installed on the phone.
The problem started after installing Ryanair app. The problem is maybe, but not surely, related to this. Uninstalling Ryanair and restarting the phone doesn't remove the occasional appearance of this lock screen.
After a while the situation has changed for the worse, now this lock screen appears after EVERY screen off.
I have always used Avast. I am not rooted and only install via Google Play.
What is this? And how do I remove it?

Thanks. I really appreciate your input. The problem right now is that I am travelling. I haven't seen a PC for months. As soon as I get to one I will try your suggestion. / Is there anything else to do before that?

So does this lock screen appears out of nowhere, I mean you're using your device and then it shows up, or, you put the device to sleep, awake it and gets to see that lock screen? You've also made certain that there is no fishy device administrator under Settings -> Security -> Device administrators?

Can you provide us a list of user installed apps which can "draw over other apps"? This may help: Determine which app is drawing on top of other apps?

Device administrators ok. / It never appears "suddenly" when I work on the phone. It only appears after waking up the screen saver, f.ex after closing flip cover, pressing on/off button or "spontaneous black screen after 2 min inactivity". Right now every time! But not always every time. // I'll come up with a better error-description when I can.

Thanks. It is late in my time zone. I'll come back as soon as I can with list of "draw over" apps.

Recently uppdated apps:
http://i.imgur.com/ubKgTqJ.png
http://i.imgur.com/N3tyzsu.png
Permission to draw over:
http://i.imgur.com/LFFR91h.png
http://i.imgur.com/4FWOijI.png
http://i.imgur.com/jKAh5mB.png
http://i.imgur.com/qdbxCHA.png
http://i.imgur.com/bJYMeLi.png
http://i.imgur.com/mY0cmNk.png
http://i.imgur.com/KCcXzty.png
http://i.imgur.com/k8YLjsq.png

Which Android version are you using? If earlier than Android 6, then could you follow the section Apps for apps here in its entirety?  For Android 6, use Andrew's answer.

I use 5.0. So I used this to produce the list of my "draw over apps". http://i.imgur.com/olYzDCh.png I thought that was according to Andrew's answer?

Also, reverse image-searching your screenshot brought a similar screenshot about DU Battery Saver & Fast Charge app.

Ok, thanks for your efforts. It's pretty irritating so please let me know if you find something. I read some people saying that some "trusted devices" should be removed. But I don't know which and there are many in the list. http://i.imgur.com/i4Fl5vn.png (Next time I'll use browser to delete question, thanks.)

I have not had any problems now for approx. 6 months. I keep the ES file manager. Today a "charging booster" lock screen appeared. But it could be disabled in its setup. I suspect the ES file explorer, but I am not sure.

This lockscreen replacement is caused by an ad from DU Quick Charge
I am pretty sure that this lockscreen was added to the app "ES App Locker". Many User-Revievs are stating that this app comes with lots of unwanted ads and lockscreen-replacements.
See this review:

This is what they are answering to most people:

So you either have the option to turn this settings off apparently or remove this application.
You can check the user-reviews here: Google Play Story
Disabling DU Quick Charge may not work on devices. In this case insure that you completely remove the application. If the quick charge screen continues to display, check to see if you have any other apps that have this "adware" and remove them.

EDIT:
Based on the information seen in another question I wanted to update this answer. It seems like quite a handful of applications have added this lockscreen replacement in their latest updates. There is one Reddit discussion which mentions a few apps.

ES App Locker and ES File Explorer Pro
Xender
Touchpal
Amber Weather
GO Weather Forecast & Widgets / (infact most Apps related to GO)
Z Camera
Kitty Play
Locx
Peel Remote

As @Andrew T. pointed out - the main cause of this lockscreen replacement is the advertisement of DU Quick Charge - developed by DU APPS STUDIO.
If you are experiencing similar problems then check this helpful answer by @Firelord to check which app might cause this.
I'll try to update this answer from time to time.

THANKS, THAT SEEMS TO HAVE REMOVED THE UNWANTED ADWARE! Opening ES App Locker not possible since it was locked with a pattern. I NEVER USE PATTERN. It thus seems like a very risky program. (But ES File Explorer Pro is the file manager I mostly use, unfortunately.) It was possible to uninstall ES App Locker though. But then stock pin-lock screen appeared in Android. Fortunately correct pin was an old one I once tried. THANKS AGAIN. I'LL COME BACK IF PROBLEM REAPPEARS. VERY VALUABLE ANSWER.

I switched away from ES File Explorer after using it for like 3 years just because of the integration of ads and changing the user-interface. The once simple-to-handle program has changed a lot in my opinion. If you're looking for a replacement in the near future you can check out @Izzy s list of applications for filemanaging

@AndrewT. Added :) I'll check the reddit thread from time to time in the next few days and have a look at future questions which may address this issue and add these apps when I can. If you or anyone else finds more feel free to edit them in or (if it makes sense) make this a community-wiki :)

Wife just started getting this; we think it was from this app: https://play.google.com/store/apps/details?id=com.contextlogic.geek&hl=en_GB

Removed Loc X (https://play.google.com/store/apps/details?id=com.cyou.privacysecurity&hl=en_ and DU Quick Charge was removed along with it =]

Looks like ES File Explorer has now removed it too source

This ads lockscreen is also in a TON of DU and ES apps, including DU Battery Saver and DU Speed Booster.

I've cleaned up comments that were not adding any value to the answer.

For people like me who hate ES Explorer doing this but can't move away from it right now(because of its loads of features!):
We can disable this unnecessary feature:

Go to Es Explorer Tools and disable charging boost.

This will remove the annoying ad screen you see when you plugin the charging cable.

A Reddit user has started to collect together the apps that have included this 'feature'/adware.
The list currently contains:

Xender
ES File explorer (by ES Global)  Removed
ES App Locker (by ES Global)
KittyPlay Wallpapers Ringtones
GO apps (Go Weather, Keyboard, SMS, Next Browser)
TouchPal Suite (Anything made by them)
Z Camera
HiFont
TrustGo
Battery Doctor
InstaMag
FotoRus - Photo Editor Pro
UC Browser
App2SD
360security
Photo Editor Pro by Zentertain
AppLock by Fotoable,Inc
Secret Video Recorder by CME Services
Between
Sharecloud (by For2ww)
Flashlight & LED Torch (by Zentertain)
Photo Collage Editor by Zentertian
LOCX: App Lock (CY Secure)
XBrowser - Super Fast and mini by XMan
iMuslim
Solo Launcher
Go Speed
Photo Grid
Avast Mobile Security free
S Photo Editor
AllShare
Multi Calculator

This list was helpful for me to identify the "culprit" app. For me it was "AllShare" app - if you can, then please verify and add it to your list, bmdixon.

You can add Multi Calculator to the list.

It seems ES File Explorer does this now - I have had it installed for years, but today I saw DU Quick Charge pop up and it seems to be tied with an update of ES File Explorer. I uninstalled it and the malware is gone.

Was it the free version of ES File Explorer or was it the pay/Pro version? (I saw the lock screen once only, today. I have both these installed.)

It was the free version

Thanks. If this lock screen reappears I will uninstall the free version. It is often also time consuming to uninstall, since you have to enter all passwords (cloud, ftp), set up windows etc when you reinstall.

This is to provide additional evidence that ES Explorer is  another culprit, from the family of ES apps
Network Monitoring: How to Get Started and Why You Should Consider it, a post which appeared on XDA portal yesterday confirms this using Fiddler- The free web debugging proxy for any browser, system or platform
The XDA post explains, set up of Fiddler, creating a proxy, connecting your phone and laptop on the same WiFi network and analysing traffic. In particular, it analysed traffic from ES Explorer and says

Even though the Pro version does not come with ads, several MBs worth are still being downloaded just not shown.

The app is built poorly with no regard for efficiency.

The app is communicating with Baidu constantly.

Post ends with pictorial evidence of other malware assosciated with ES Explorer

Amber Weather was the reason DU Quick Charge was added to my lock screen.  ES File Explorer and ES App Locker was not the cause.

Amber Weather was not the cause foe me, either.

It was ES App Locker, and they are currently sock puppet blasting the app with 5 star ratings to try and counter the deluge of 1 stars... It's pretty sad actually, and it's why I switched to Solid File manager, which I actually like more than I liked es... It does a 14 day trial before you have to buy in, But there are a bunch of alternatives that aren't pay to use, such as Amaze File manager which is open source, so it should never be pay to use.

I hope people give comments in Play Store about it, if there is suddenly a high influx of 5-star ratings.

In my phone the reason for the lockscreen was the Xender File Sharing App. When I clicked the little gear(settings) icon on the top right corner it gave me an option to switch off the Xender Quikcharge feature and so I did. I don't get this screen anymore.
I went to the Xender app page on the Google Play Store and a lot of other users had also complained about the same problem. Hope this helps.

Please link app from Play Store

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Potential Android virus removal and best practices
I was browsing the web and I ended up on a site with one of those pop ups that plagued my browser window with "Your device is infected, please go to insert dodgy link to remove malware" type messages. It also downloaded a file called "download"....I didn't find the file type. At the same time, avast! flagged it as containing malware. I immediately deleted the file and scanned my device with several antivirus scanners, which all came back clean.
Is there any chance there is anything nasty lingering on my phone? I didn't click the downloaded file, deleted immediately and my virus scans came back clean. I also don't allow installation from unknown sources.
Finally, can anyone recommend me a comprehensive antivirus program?

Unfortunately, Android antivirus solutions aren't very effective because of Android's sandbox.

I believe your device is safe. The ads is a scare-tactic to make you install the malware, and fortunately you mitigated this (also, thanks to Avast). App recommendation is unfortunately off-topic, though.


text:
Getting absolute path with "ls" command
Is it possible to output the absolute file path when executing ls -l on Android (e.g. via adb shell or in a terminal app)?
Here is the output I get from ls -l /etc/ (I have root access):
E:\Dropbox\Droid Explorer\src\main\resources\com\droid\explorer\adb>adb shell su root ls -l /etc/
-rw-r--r-- root     root        16656 2009-01-01 03:00 CHANGELOG-CM.txt
-rw-r--r-- root     root         9944 2009-01-01 03:00 CHANGES.txt
-rw-r--r-- root     root       154482 2009-01-01 03:00 NOTICE.html.gz
drwxr-xr-x root     root              2009-01-01 03:00 acdbdata
-rw-r--r-- root     root       598006 2009-01-01 03:00 apns-conf.xml
-rw-r--r-- root     root         5491 2009-01-01 03:00 audio_effects.conf
-rw-r--r-- root     root         6198 2009-01-01 03:00 audio_policy.conf
drwxr-xr-x root     root              2009-01-01 03:00 bash
drwxr-xr-x root     root              2009-01-01 03:00 bluetooth
-rw-r--r-- root     root       101774 2009-01-01 03:00 build-manifest.xml
-rw-r--r-- root     root         1045 2009-01-01 03:00 clatd.conf
drwxr-xr-x root     root              2009-01-01 03:00 dhcpcd
-rw-r--r-- root     root         1362 2009-01-01 03:00 ethertypes
-rw-r--r-- root     root        18300 2009-01-01 03:00 event-log-tags
-rw-r--r-- root     root        14309 2009-01-01 03:00 fallback_fonts.xml

What I would like to get is the absolute path, ex:
E:\Dropbox\Droid Explorer\src\main\resources\com\droid\explorer\adb>adb shell su root ls -l /etc/
-rw-r--r-- root     root        16656 2009-01-01 03:00 /etc/CHANGELOG-CM.txt
-rw-r--r-- root     root         9944 2009-01-01 03:00 /etc/CHANGES.txt
-rw-r--r-- root     root       154482 2009-01-01 03:00 /etc/NOTICE.html.gz
drwxr-xr-x root     root              2009-01-01 03:00 /etc/acdbdata
-rw-r--r-- root     root       598006 2009-01-01 03:00 /etc/apns-conf.xml
-rw-r--r-- root     root         5491 2009-01-01 03:00 /etc/audio_effects.conf
-rw-r--r-- root     root         6198 2009-01-01 03:00 /etc/audio_policy.conf
drwxr-xr-x root     root              2009-01-01 03:00 /etc/bash
drwxr-xr-x root     root              2009-01-01 03:00 /etc/bluetooth
-rw-r--r-- root     root       101774 2009-01-01 03:00 /etc/build-manifest.xml
-rw-r--r-- root     root         1045 2009-01-01 03:00 /etc/clatd.conf
drwxr-xr-x root     root              2009-01-01 03:00 /etc/dhcpcd
-rw-r--r-- root     root         1362 2009-01-01 03:00 /etc/ethertypes
-rw-r--r-- root     root        18300 2009-01-01 03:00 /etc/event-log-tags
-rw-r--r-- root     root        14309 2009-01-01 03:00 /etc/fallback_fonts.xml

ls by default list everything supplied via argument. From man ls:

-d, --directory
               list directories themselves, not their contents
-l     use a long listing format

So you can simly supply everything inside your targer directory, and give the option -d.
[adb shell] [su -c] ls -dl /etc/*
^ optional, depending on your shell environment

Which gives
rwxr--r-- 1 root root 1024 Jun 4 22:32 /etc/hosts
...
(and a lone list)

Since the Android is rooted, you can use any of the following commands:

# Replace DIR with the directory's path; prefix adb shell wherever appropriate.

su -c 'busybox ls -ld DIR*'
su -c 'toybox ls -ld DIR*'
su -c 'ls -d DIR*'  # this does not work with long list format available through -l

(Courtesy of the answer here from An̲̳̳drew for listing the argument -d).
Android Marshmallow comes with Toybox. For any other Android version, you would need to setup BusyBox or Toybox.
Example:

So I'm guessing the adb shell ls is limited. Dang I was hoping to do this without busybox. Thanks anyways

You can also write a recursive list function in sh - this function can be copy-pasted in adb shell, without root permissions:
function rcrls() { ls -d $1/* | while read f; do echo "$f"; if [ -d "$f" ]; then rcrls "$f"; fi; done }

Then, use it as:
shell@myphone:/ $ rcrls /

Unfortunately, it will persist only for the current adb shell session, once you're out of it, you'll have to paste it again; or you can use it like this:
$ adb shell 'function rcrls() { ls -d $1/* | while read f; do echo "$f"; if [ -d "$f" ]; then rcrls "$f"; fi; done } ; rcrls /' | less

Then you can see files listed as:
...
//acct/uid/1000
//acct/uid/1000/cgroup.clone_children
//acct/uid/1000/cgroup.event_control
//acct/uid/1000/cgroup.procs
//acct/uid/1000/cpuacct.stat
//acct/uid/1000/cpuacct.usage
...

To get a listing with -l info, it's a bit tricky, since there's no working sed on adb shell; however, we can use string variable shell expansion and truncating to remove the basename from the listing, and then we can append the full path:
function rcrls() {
  ls -d $1/* | while read f; do
    if [ -d "$f" ]; then
       fl="$(ls -ld $f/)";
       echo "${fl%\ *}" "$f";
       rcrls "$f";
    else
       fl="$(ls -l $f)";
       echo "${fl%\ *}" "$f";
    fi;
  done
} ;
rcrls /

Or, as one liner:
adb shell 'function rcrls() { ls -d $1/* | while read f; do if [ -d "$f" ]; then fl="$(ls -ld $f/)"; echo "${fl%\ *}" "$f"; rcrls "$f"; else fl="$(ls -l $f)"; echo "${fl%\ *}" "$f"; fi; done } ; rcrls /' | less

... and then you get a listing as:
drwxr-xr-x root     root              2017-11-15 02:29 //acct
-rw-r--r-- root     root            0 2017-11-15 02:29 //acct/cgroup.clone_children
--w--w--w- root     root            0 2017-11-15 02:29 //acct/cgroup.event_control
-rw-r--r-- root     root            0 2017-11-15 02:29 //acct/cgroup.procs
-r--r--r-- root     root            0 2017-11-15 02:29 //acct/cpuacct.stat
...


text:
When an app wants permissions, is it isolated from others?
When an app asks for permissions for my media folder for example, does this mean it can access anything in my media folder?
Are apps isolated to only save/read from a subfolder inside my media folder that is specific to that app?
Example, can an app potentially download all of my camera pictures?
I was using Whatsapp, and it wanted special permissions whenever I tried to download a voice message or picture.

Yes, and it can access anything stored inside your storage, be it external or internal SD card. All it takes is this: http://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE

@Firelord is this the same with IOS?  I thought apps are sandboxed and the storage would be also sandboxed except if you give permission for things like contacts etc.

Internal storage as in /data/ is sandboxed but internal sd card as in /sdcard/ is not. I do not know how iOS handles sandboxing.

All apps can read and write files; it is a core requirement for most of them and not something that needs to be granted via permissions.  There aren't all that many apps that don't store/read any data.
So yes, when you grant the "Read external storage" permission or similar you are granting access to a common storage area.  Such apps could potentially upload all of the pictures stored there, yes.


text:
What happens to my Google Play Music library when I unsubscribe?
I'm currently shopping for a music streaming service because I'm currently unsatisfied with Spotify, my current service of choice.
Lured in by the three month free trial, I'm enjoying Google Play Music for a series of reasons, but now that I finally moved my library of music from Spotify to GPM, I'm curious about what will happen if I ever decide to unsubscribe.
Will GPM delete all the songs I added? Or, should I ever want to renew my subscription, will I find them all where I "left" them? I know I won't be able to play the songs while on the free level, obviously, but what I'm wondering is if Google will keep all the songs and albums I added, tied to my Google account or, what I'm afraid of, deletes everything forcing me to readd everything once I decide to pay again?

What happens when you cancel your subscription from Google support page says (emphasis added)

When the end of the billing period is over and your subscription is canceled, you won't be able to access music you downloaded to your device, or playlists you created.
If you subscribe again, you'll get access to your radio stations and also the playlists and music you uploaded.

What happens to All Access albums in my library when I unsubscribe from Google All Access? reiterates

If you unsubscribe from Google Play Music All Access and then re-subscribe you will not have the ability to play YouTube videos in the background on Android another setback for some users

Thanks, I searched but couldn't find anything!

I can verify that this answer is correct through experience. Even playlist access through the web-page is shutdown.  Cancelling your paid subscription won't just result in adds being played thereafter... ALL your playlists go bye-bye because... evil reasons?


text:
Should I format /sdcard and /data if I want to wipe all personal data with Cyanogenmod?
I'm trying to completely wipe all personal data from my Nexus 4 with CM installed. I've seen different advice on different sites for making sure all my data is gone:

Just do 'Factory Reset'.
Do 'Factory Reset' at least 3 times.
Do 'Factory Reset' and wipe dalvik cache.
...

and so on... I'm interested in erasing all traces of my personal data from the device. It's a Nexus 4, so there is no removable storage to worry about.
My guess would be to 'wipe data/factory reset' and 'wipe cache partition' in the main recovery menu. In the mount/storage menu, I would choose 'format /cache', 'format /data', and 'format /data and /data/media (/sdcard)'. Finally, in the advanced menu, I would choose 'wipe dalvik cache'.
Is this thorough enough? Should I also choose 'format /system', 'format /firmware', etc? Are there any options I should steer clear from? I would like the phone to boot to a fresh Cyanogenmod after clearing all data.

Just do 'Factory Reset'.

Well, this depends upon the recovery you're using. If you're using TWRP (assuming you've v2.8.4.x or above), choosing Factory Reset would remove everything under /data (excluding /data/media which serves as emulated storage available through /sdcard as internal SD card), would wipe cache partition, and since davik cache gets stored either in cache or data partition, it would already be wiped out.
If you're using stock Android recovery (<3e>) and choose Factory Reset, then it would format the data partition and cache partition. Davik and internal SD card would also be automatically taken care of by formatting.
If you're using Cyanogen recovery or any other recovery, then I can't comment. I can only  suggest switching to TWRP for better control and features.

Do 'Factory Reset' at least 3 times.
  Do 'Factory Reset' and wipe dalvik cache.

You only do it one time and that's all you need to do. As I said, a factory reset automatically wipes cache partition so you need not to explicitly wipe it. TWRP notes:

[You] need to [factory reset] and you only need to do it once, not three times as some people would lead you to believe.

As for,

I'm interested in erasing all traces of my personal data from the device

Wiping the partition wouldn't be enough if you're talking about erasing all traces of personal data. There are already Q&A discussed about that on this site, so I'm referring them to you:

When selling your phone, what steps should be taken to make sure that all personal data has been removed?
How can I erase whole phone securely?

Note that if the phone would remain with you after a factory reset/ full data+cache wipe then it is not worth the time engaging in addressing "traces of personal data" since resurrecting deleted data requires physical access to your device.

Are there any options I should steer clear from? I would like the phone to boot to a fresh CyanogenMod after clearing all data.

Yes, please stay away from anything other than /data, /data/media and /cache. System partition doesn't contain personal data and when you would flash your ROM the partition would automatically be flashed because modern ROMs (such as CyanogenMod) do that. Modem partition is mounted at /firmware so it is not worth wiping it out because that may only cause trouble for you.
Related: Won't placing a cuostm ROM file before factory reset remove it from the phone?


text:
Error looping, "Unfortunately, Setup Wizard has stopped."
With my S4 running CM13 I'm now getting this error,

Unfortunately, Setup Wizard has stopped.

How do I resolve it?

If you're going to downvote the question just tell me why. I had already found the problem when I decided to self-answer here and contribute to the question base.

Follow my answer here to ger rid of the Setup Wizard directly.

You can follow my answer here to get rid of the Setup Wizard directly.

Here is a method that you can do without whiping,

Boot into TWRP Recovery
Mount System ( Mount → check System )
Advanced → File Manager
Browse to /system/priv-app/Setup-Wizard
Delete it

Make sure to copy it to sdcard or something first though.

I followed these five steps though instead of deleting SetupWizard.apk I moved it. Now android starts and I was able to enable wifi. Afterwards I put SetupWizard.apk back through recovery and now it reappears after reboot. I get past the former screen but currently it just seems to crash further along the setup process.

On LineageOS 17 (a5xelte) /system is empty. Is it because of the android versionn?

@azmeuk probably way too late, but I think so. I came here because I just read this and it referred to a /system_root, which I don't have (flashing LOS 16). Perhaps that's the folder for LOS 17?

Deleting an app is not really a solution of a problem...

I noticed when clicking report that the issue was a permissions issue.
using adb shell dumpsys package com.google.android.setupwizard
you will see two lists related to permissions, one requested permissions, and one install permissions.
Comparing these lists, there were 8 items requested, but not installed.
I fixed this using:
pm grant com.google.android.setupwizard android.permission.CALL_PHONE
pm grant com.google.android.setupwizard android.permission.GET_ACCOUNTS
pm grant com.google.android.setupwizard android.permission.PROCESS_OUTGOING_CALLS
pm grant com.google.android.setupwizard android.permission.READ_CONTACTS
pm grant com.google.android.setupwizard android.permission.READ_PHONE_STATE
pm grant com.google.android.setupwizard android.permission.WRITE_CONTACTS

pm grant com.google.android.setupwizard android.permission.READ_OWNER_DATA
pm grant com.google.android.setupwizard android.permission.WRITE_OWNER_DATA

Note that the last two items gave an error message: Bad argument: java.lang.IllegalArgumentException: Unknown permission: android.permission.READ_OWNER_DATA.
But ignoring those, now my phone worked again.

I think I have a similar issue but I cannot find dumpsys or pm from an ADB shell, do you know if they may have been removed or if I need to install something first?

Make sure in Settings > Developers Options you have enabled USB Debugging (now called Android debugging) and under Root access you have selected Apps and ADB.
Connect the USB cable to a computer that has adb installed and working (assuming it is available in PATH).
From the terminal run:

adb root
adb shell 'pm disable com.google.android.setupwizard'

If you don't have root or if adb root fails, then you can use instead adb shell 'pm hide com.google.android.setupwizard'.
NOTE: This problem usually happens when installing a major CM update without wiping the data partition, so probably a cleaner solution would be backing up all the relevant apps, doing a clean install, installing the correct version of gapps, and then restoring your app data from backups.

After using  adb shell 'pm disable com.google.android.setupwizard' I managed to get into the system and enter my google account information, then I enabled it from 'adb shell 'pm enable com.google.android.setupwizard'  to complete the setup.

I tried all the solutions listed here, and in my case they didn't work. Removing the setupwizard alltogether did work, but it also broke multiuser functionality (apparently the default user gets created in the wizard, and without the user you can't create more users!). Also the home-button and square-button didn't work at all. So I decided to flash the image again and solve the problem instead of curing the symptoms.
In my case, I had to get into the settings menu and enable+connect to WiFi. Apparently the wizard "forgets" to show the connect to wifi dialog!
Getting into the settings menu took a few tries, but it's absolutely doable.
Once I was connected to wifi, it worked as it should. I'm running AOSP 7.1.2 on a Nexus 7 2012.

For me this solution worked. It might be annoying as you have to do all the clicks in between the Setup Wizard error messages.
And yes, this method will work in all the versions of android (including 7.1.1-Tested)

Go to Settings (from notification panel, obviously)
Go to Apps
Click on the 3 dots in upper right corner
Click on Show system
Scroll all the way to Setup wizard in the list of apps and click on it
(Under the permission you will probably see something like No permissions)
Click on Permissions
Grant permissions to both Telephone and Contacts, (if there is any other like, camera, location, Grant Them All)

The error message disappeared as soon as I did this. Hope it helps
;)

What if notification panel doesn't come down? USB Debugging disabled...


text:
Install multiple apps from Play Store with single click
The requirement goes like this.
Requirement 1:

Install parent app from Play Store with 2 or 3 feature buttons.
Once clicked, it should download and install corresponding apps from Play Store. (Catch here: it should not go to Play Store and ask to install)

Or requirement 2:

Install parent app from Play Store with single clickable button.
Once clicked, it should cumulatively install 2 or 3 apps from Play Store.

Is it possible?

Unless you're from Google, you can't, and for good reasons why Google prohibits it.
I assume you want to do this for better user-experience, in which they can conveniently install what they need with their consent. However, let's put aside that idea and think another possibility: a seemingly-safe app can install rogue apps from Play Store automatically without user's consent!
There's a more detailed explanation on an answer by ozbek on Stack Overflow, in which you can only request Play Store to install an app silently if your app is signed by Google.


text:
Creating a backup with adb results in 41 byte file
I have an old droid RAZR Maxx (4.1.2) that I decided I want to root, but I want to make a backup first just in case. I've followed instructions from this site:
How To Create a Full Android Phone or Tablet Backup Without Rooting or Unlocking Your Device
My command was this:
adb backup -apk -shared -all -f c:\backup.ab

The resulting backup.ab file on the C: drive was only 41 bytes and, when opened in a hex editor, appears to only be the header of the backup file. I'm wondering what I'm doing wrong here, I've googled but can't find anything that helps. Any suggestions?
Edit: This is not a duplicate of the suggested a topic linked by beeshyams. That topic explains why the user couldn't back up one single app's files, I'm trying to back up everything. I don't care if I don't get SMS included in that backup because it's an old phone, I'm not using it to text, but there are other apps and settings that should back up without issue.

Search [tag:adb] tag (added to your question), duplicate of http://android.stackexchange.com/q/114437/131553

It's not a duplicate, I'm not asking how to just back up SMS/MMS, but the entire phone. Apps, settings, files, etc. I've tried this on two different Motorola phones now with the same result (the other one was a droid ultra).

It doesn't explain why a requested backup of the entire system results in a 41 byte file, it explains why the backup of a single app does, so it doesn't answer my question.

See this, if it still doesn't address, quote this in your question and amplify

That answer literally says to do exactly what my question says I did. I've got the path to adb on my environment variables so I click start, type "cmd" type "adb devices" to make sure my phone is connected properly (which it is), then I type the backup command and I get a 41 byte file, every time. I'm not worried about backing up calendar, contacts or SMS data, but there's nothing about the entire thing failing because those apps can't be backed up.

Can you try making a backup of a single app and see if you still end up with only header information? Try with an app which doesn't disallow backup, such Firefox or ES File Explorer.

I will try that and add a comment in a minute, but I thought I should note here that I rooted the device last night and I still can't get the backup to work. I've verified that I have root access, I do, but the backup still results in a 41 byte file. I'll comment with my results of a single app.

Ok, I tested. I'm not 100% sure the command was right, I can't find a ton of documentation on the backup command, but I used this: adb backup -f C:\esbackup.ab com.estrongs.android.pop and I still got a 41 byte file. I tried this command too: adb backup -shared -f C:\testbackup.ab with the same results. Seems my phone just doesn't want to do a stupid backup!

Consider using @ followed by user's name to notify them, such as @Firelord, else the user would not be notified of your followup comment. Now, could you try this command: adb shell bu backup com.estrongs.android.pop > C:\es_new_backup.ab and see if it still causes a 41 bytes file? If the issue persist, please have a new terminal/console running adb logcat and in another one, issue your app specific adb backup command and observe errors or anything in logcat's output. You may as well share the output with us too.

I'm facing with a similar issue, and, for example, Helium Backup complains for an application that is disallowed to be backed up. This might be related to your question as well: http://android.stackexchange.com/questions/68209/what-is-the-purpose-of-an-app-disallowing-backups-androidallowbackup-false

Found solution here, worked for me:
https://docs.j7k6.org/android-adb-backup-41-bytes-549-bytes-bug-fix/

Appearantly the adb backup command stopped working for older Android
  devices in recent versions of the Android Debug Bridge. When invoking
  a backup with adb, the backup process is started but stops
  immediately, leaving a local backup.ab file with a filesize of only 49
  bytes (549 bytes when the backup is encrypted with a password). This
  bug is well known, but hasn’t been fixed at least until recently
  (version 1.0.39). To fix this behaviour, download the last working
  version of the adb executable (1.0.31) and invoke the backup with
  this. The executables for all platforms can be downloaded at Mozilla.

https://archive.mozilla.org/pub/labs/android-tools/
adb-1.0.31-linux.zip    479K    09-Sep-2015 18:44
adb-1.0.31-linux64.zip  455K    09-Sep-2015 18:44
adb-1.0.31-mac.zip  433K    09-Sep-2015 18:44
adb-1.0.31-windows.zip  474K    09-Sep-2015 18:44

Download, unzip, run unzipped adb:
(linux, mac)
./adb devices
./adb backup -apk -shared -all -f backup-file.adb

(win)
adb devices
adb backup -apk -shared -all -f backup-file.adb

Enjoy! ;)

Does this only work with -all? I'm trying adb backup -noapk com.android.chrome with version 1.0.40 and I still get the 549 bytes file..

I tried with 1.0.31 but it does not make the backup prompt appear on my phone. Android 8.0.0.

@thomasa88, quote from answer:"Appearantly the adb backup command stopped working for older Android devices". Android 8.0.0 is prelast version of android on 04.2019.
adb-1.0.31 I use for android 4...
For newer(8.0.0) version of android try use newer versions of adb.

You should not try to backup the "entire" phone with adb, because it's plenty of bugs. My recommendation is to backup apps one by one and avoid the '-shared' flag because backup of shared storage is broken. Just copy and paste to a memory card of use ftp server to upload to your computer those things from internal sdcard.
Again: backup one app at a time and check for .ab file size so it's not "empty". It will be empty when the unencrypted backup has 41, 47 or 49 byte size. If encrypted will be 549 byte size for empty.
Latest adb is 1.0.41
Note also that some apps don't allow adb backup, and other even if allow it don't "store" anything on there because of app policy. Examples are apps which use cloud services like Google, etc.


text:
How to check when the phone was turned on? (4.4 kitkat)
I turned my phone on today and there's something weird there. I would like to check if someone turned it on recently. Like, computer booting log. How can I do it?

AFAIK there is no protocol of that – unless you've setup something yourself.


text:
Can MTP be configured to show the root?
I have a rooted device running Android 6.
When I connect it via USB, I can browse files via MTP, but it is limited the the /sdcard folder, for instance I can see Downloads and DCIM but I can't access /system/app.
QUESTION: Is there a setting or trick that would allow me to access / via MTP?
Very technical procedures such as recompiling system programs are OK too.

I don't know if it is possible to modify MTP mode, but my workaround would be to enable USB debugging/ADB and use a program like QtADB.

@Robert: Thanks but I am explicitely asking about MTP, it is for a solution that must be compatible with any MTP client.

@acejavelin FYI, you can delete your own comment: no need to flag it for a moderator to remove.

The simple answer is no, you can't... You are not really looking at /sdcard but at a database of what that card contains provided by External Storage and possibly Media Storage. MTP has replaced USB Mass Storage (which would allow this) for a variety of reasons, many are security reasons, and they are encoded deep within the Android source code in multiple areas. MTP is specifically designed to only give access to user files (/sdcard and /storage/{volname}) and nothing else. I don't think you will find a way, root or otherwise, to this without heavily modifying the base code of Android

"You are not really looking at /sdcard but at a database of what that card contains provided by External Storage and possibly Media Storage" -- can we have something verifiable that supports this claim?

@Firelord In a quick search I was not able to find verification of that specifically, but my claim can be based on the fact that in Marshmallow devices require External Storage app to work. If you delete data on this app and connect via MTP, nothing will show up (directory will be empty on PC), if you then reboot and allow the database for the app to rebuild then connect to the PC, the files will show. Logic says that app is giving access to the files, although I understand that correlation may not be causation in this case. If I find more specific verification of this later I will share it.


text:
How can one receive android updates?
How can one install android OS updates even when the manufacturer doesn't provide any? I have an android lollipop phone and wish to update it to marshmallow.

The android update will be provided by OTA by the manufaturer itself.
Go to Settings->About Phone->Check for Updates in your android device.
Can you please share your device model name and number? and the current version of android?

Anand, that doesn't answer the question: "when the manufacturer doesn't provide any" contradicts with checking for OTA updates "by the manufacturer itself" :)

But this is the basic method to check for official updates right?

But that was not the question. The manufacturer doesn't provide an update just because you push a button. And if there is no update provided by the manufacturer, pushing the button won't find any. The question was how to update when the manufacturer does not provide any – and you answered how to do it when the manufacturer does provide an OTA update. No match here. The correct answer in such a case is finding a custom ROM matching the device – which cannot be done by pressing that button.


text:
Bricked Onda v919 64gb (without 3g)
I currently bought a tablet Onda v919 from China. When I received it I realized that the installed android did not contain Google Play, and after reading about it I found out that you could make an upgrade with a later rom to fix this. I followed a guide to do this, but after I finished my tablet will not start.
When booting I enter what I think is the efi console.
To fix this I have tried to reinstall windows from backup images. However I have not been able to make a bootable usb drive.
Does anyone have any tips on how to reinstall my tablet?
Best regards
David

Why are you trying to "reinstall Windows" on an Android tablet? It seems unlikely that your tablet would even boot from a USB drive.

Oh, I realize my question was not that clear. It is a dual boot device but now does neither android or windows start.

It sounds like you have corrupted your partitions. To fix this you either need to rebuild your partitions (which requires a knowledge of the device and MBR or GPT, and will need know how the factory ROM is imaged).
Or you can repartition your tablet by flashing it with a factory ROM. This will revert the tablet back to its original state. Thus erasing all of your data.


text:
What installed "DU quick charge" on my phone?
I started seeing something new on my lock screen, before even swiping the lock screen. It was a large battery charging-status display with advertisements below that. At the upper left corner was a gear for setup. Touching that displayed "DU Quick Charge" with a little slider to turn it off. I turned it off and the display has never appeared again. But I want to know where this came from. A Google search gave me one article describing my issue exactly, except it involves different software than I have. The image provided is the same. Obviously "DU quick charge" is a library someone is selling. How do I find what software did this on my phone? It seems to have already disappeared from the recently updated list at the play store.
Link to article
Link to image

See if this is the cause: What is this lock screen with ads and how do I remove it?

I voted to close as dupe of above question. There's nothing wrong with your question, but since the given answer also tries to cover your question, it's better to centralized all info, and your question is a good signpost to it.

Yes, the previous question is the same having good answers. Thanks


text:
Android says Damaged SD card at EVERY card
I faced a problem with my 32 GB SD Card on Samsung Galaxy Grand Prime. Device says Damaged SD card. I changed it to a brand new (also 32 GB) SD card... And problem didn't gone. Each card read perfect via card reader, but not on my phone.. What can I do?

Cell phone and Android questions are off topic here, so this is being voted to be migrated to the proper site to get you the help you seek.

Run chkdsk [SDCard Drive Letter] /r where [ ] is where you will put the drive letter. so the example will look like this chkdsk D: /r Example drive letter being D run that then try your card.

@NetworkKingPin On Windows?

Yes that is for Windows. On command prompt forgot to say that

If two cards have become damaged it would suggest that the card reader in the phone is broken.

Try reading the card with a USB card reader, connected to phone. If fine it confirms what Burgi said

Can you manually format the card in the phone?

The grand prime is known to cause electrical damage to sd cards and without warning. I have two of these phones and they each destroy an sd card every 3 months. The cards may have self sensed damage and dropped into read only mode, in which case you can read them with a usb reader on a desktop but the phone will refuse to mount at all, and the will not be writable in any case.

Sounds like it's the card reader in the phone if the cards are working perfectly with other card readers. Also alot of people with the grand prime have been having the same problems at you.


text:
Why does Android show more space used in internal storage than what adds up in the details?
I have a Moto G (3g) with Android 6. I noticed that When I go to Settings>Storage>Internal Storage, it shows that 2.85GB are being used out of 11.81GB. However, If I add up the storage shown for each category, the results are less than what is shown as total usage.
This are the values shown:

Apps: 1.25GB
Images: 10.74MB
Videos: 0.00 B
Audio: 0.00 B
Misc.:1.62MB
Cache: 6.97MB

I have used several tools (like Storage Space) and they all show the same.
I used DiskUsage and it shows a "System data" used storage, that fills in the gap.
I know Android has a system partition, but this "System data" is shown in the data partition.
Why does this happen? What is stored in "System Data"?

In my Android versions, it also incorrectly reports the details. It under-reports in Android 5.1.1 and hugely overestimate in Android 6.0.1.

DiskUsage is giving you the correct information.  Per the developer of DiskUsage:

System data consists of several things:

Unpacked dalvik bytecodes corresponding to your installed apks. If you install app on external storage, it still consumes space on your data partition.

Crash dumps stored in tombstones directory.

Any other data or settings android store on your device.

This data is hidden and DiskUsage can't easily identify how much space each of this consume. Usually (1) consumes most, so if you want to cleanup some space you may want to delete apps on external storage.

http://androidforums.com/threads/disk-usage.181747/


text:
Android 2.2 security in 2016
I have an old Samsung Dart t499 that I would like to give to my son for simple texting and phone calls.
Assuming that (1) we don't install any apps and just use the ones that came by default on the device; (2) we turn off MMS autoretrieval; (3) we don't browse the web, open sms or respond to sms messages from unknown people and (4) we use a Google account created just for this device and not linked to any other information or accounts that we have.
Are there any security concerns/risks that we need to be aware of?

Unless you plan to use the Google account for location, why specifically you need an Android phone for?

It is much easier to text by using voice recognition than it is to type.  Plus the phone has a decent camera compared to a feature phone.  Plus we already own the phone and it seems a shame not to use it for something.


text:
Galaxy S5 Freezes Constantly
I have a Samsung Galaxy S5 from Verizon, bought a little over one year ago. As soon as the one year warranty was over the device started acting up. Right now it is in an unreliable working state.
Symptoms:

The device freezes almost constantly at a rate of at least once an hour (4 times in the past 3 hours).
There is not one app in particular to cause the freeze, that I can trace to. It seems that any time I do something which requires it to work a little, like loading a web page, brings the device to a freeze.
Sometimes it just restarts.
Sometimes it says "Start Up Failed" when booting up.

What I've done:

Removed the SD card completely.
Reset the device to factory defaults multiple times (about once per week). After this, it works good for a few days then goes back into freezing mode.
Uninstalled most of the apps, especially the once I don't really use daily.
Disabled all the pre-installed Verizon apps (the once that I could).
Disabled auto updates.
Took the device to the local Verizon shop and they didn't do anything to help, besides trying to get me to buy something else.

Any idea of what else I could do to fix this issue?
EDIT
The device got to a point where it became impossible to perform any operations. If it wasn't constantly restarting, it would restart at the very first operation. Any attempt to do anything on the device sent it into restart.
I was able to talk to a few technicians from Samsung and they determined that the problem sits with the hardware, perhaps the motherboard. Therefore I ended up sending the device to Samsung for repair.

Which android version are you using? Have you considered installing custom roms or reflashing the stock firmware?

@benjaminS No modifications have been done to the OS/device at all. It runs exactly what it came with from Verizon, Android 5.0. I thought about flashing it, but haven't made that decision yet.

What temperature you have observed on the device. Is your Battery and charger of good condition? If they are good try re-flashing and updating the stock.

As a method of starting to debug this, Linux keeps a log for the kernel. I'm not sure if /proc/last_kmsg is there or not, but you want the kernel log.
I'd start by replacing the stock recovery with TWRP. Whether or not you want to Flash to a different rom. TWRP has a file browser. It should let you save the kernel's log either way. You want to pay attention to two files:

/var/log/boot.msg (useful in the state after the failed boot)
/var/log/syslog (useful in the state after the crash, and the state after the boot)

You'll want to thoroughly examine these files and paste the contents up here. It's possible the problem is hardware though. I'd flash CM13 (because it's all around better), and see if that fixes it. If problems persist on a fresh CM13, you know you've got a hardware issue.

I would advise, as your next step, to attempt reformatting the phone with the stock images. This will erase the device completely.
Follow this guide. The procedure provides all the files you need, and walks you through the steps needed to perform to reinstall the factory images.
You may also be interested in installing TWRP recovery, as I 2nd Even Carroll's suggestion of installing CyanogenMod13 as a last ditch effort to stop this.
Should the problem persist, after reinstalling the factory images and from installing CM13 (an alternative) I would be hard pressed to think the storage on your device is malfunctioning and needs service.

I found a few solutions online, maybe you can glean some information from them as they seem to all relate to the model you are having issues with:
http://thedroidguy.com/2015/05/how-to-fix-freezing-lag-slow-performance-problems-on-samsung-galaxy-s5-part-1-107191
http://thedroidguy.com/2015/10/how-to-troubleshoot-a-samsung-galaxy-s5-that-constantly-freezes-and-lags-other-performance-issues-1050209
Hope that helps.  They also have a form you can fill in to state your specific problem, perhaps they can assist if none of the other solutions work.

While this link may answer the question,
it is better to include the essential parts of the answer here
and provide the link for reference.
Link-only answers can become invalid if the linked page changes

The steps depicted in the links are the same as the ones I've taken to troubleshoot the problem.

Thank you AADTechnical.  You have a valid point there.  Moving forward I will adhere to that.  As a new member, I'm still learning the ropes.


text:
What tool can I use to measure the volume of .mp3 on my S6 + make the volume all the same?
I have powerAmp paid and I have mp3's from different sources. How do I measure the decibel levels of each clip + adjust it to make it the same? I used to use Mp3gain on the desktop. Anything like that for Android on and S6?

PowerAmp can read ReplayGain values written to the mp3 files, but does not do any analysis itself.  The best option would be to apply ReplayGain tags using something like foobar2000 on your desktop, and then copy those files over to your S6.


text:
Why does it say that my phone isn't rooted properly?
Question:
Why does it say that my phone isn't rooted properly? Also, can it get bricked?
Full story:
I got some malware, which my antivirus couldn't detect, so I installed an app called "Stubborn Trojan Killer" from the google play store. It told me that in order to stop the malware I had to root my phone and gave me instructions.
In the instructions it included two root programs, one is "KingRoot" and the second one is "KingoRoot". I tried the second one first, but it didn't work, so then I tried the first one and it did, but the other antivirus programs I installed kept labeling it as a virus, plus I read somewhere that the program itself is shady, so I decided to uninstall it.
So getting to the point, I read somewhere that rooting your device can get it "bricked" (would be great if someone can explain how you ACTUALLY brick your phone), so I got paranoid and downloaded an app called "Root Checker" It checked if I had root access, but it didn't give me a clear yes or no, it just said that it isn't installed properly and now I'm paranoid that it could get bricked or something.
How do I fix this? I'm really new to rooting and all of that so I would appreciate some help.
My phone's name is Allview Soul Style, and it runs Android 5.1.

To Firelord: Yes my android model is 5.1 and my phone's name is Allview Soul Style. I don't understand what you mean, I just rooted my phone and the other antivirus programs showed that It's malware, so when I uninstalled KingRoot it stopped and said that it's fixed. I'm just paranoid because it says that my root isn't rooted properly, although it did when I hadn't uninstalled KingRoot if I may add. I checked if It's rooted from "Root Checker", and it said that it isn't working properly, so I'm paranoid that it might get bricked, even though I'm not sure how bricking really works.

If your device were bricked, it would be working like this – but not boot up, able to start apps, and telling you it's not rooted properly. From the reports we get here, I'd keep my fingers off Kingoroot – but that's too late for you now. If you want to be absolutely safe, you could flash a clean ROM.

I was talking about KingRoot and not KingoRoot, KingoRoot didn't appear as malware. Anyway, the malware got away when I uninstalled KingRoot, so I don't want to be too impulsive. Yes I know that my phone isn't bricked but, I'm paranoid that it might get bricked because it says that the root didn't root properly.

Sorry for messing up the two – I'll never keep them apart :) As I wrote, against paranoia there's flashing a clean ROM :)

What about what the program said? Is it a problem that it says that the root hasn't been installed properly?

Parts of it have been removed by uninstalling it I guess. Cannot say, never used it myself.