Originally Posted by bin.sayantan
The helper app installs the apks using package manager and then unpacks the data of the respective apps in /data/data. Finally it restores all the apps runtime permissions.
Does it handle folder permissions when there are changes in app uid for data restore
when pm installs app, app uid can be different than before, so there might be folder permission discrepencies?
if [ "$1" != "" ];
#The folders in /data/data each have a different owner. The next line gets the owner and the strips the whitespace
appusername=$(stat -c "%U" /data/data/$1 | xargs)
#The next line constructs the chown command to repair the permissions for all the files in the target folder
fixperm="chown -R $appusername:$appusername /data/data/$1/*"
#Display the command to the user
#Uncomment the next line if you would like the script to fix the permission
else echo "Missing target folder parameter"