Move "Any" App to SD Natively - Samsung Galaxy S (4G Model)

I wish I could claim credit for this deep insight, but credit goes to AntonX for describing this approach buried in another thread between a lot of whining.
From what I can tell, you do not need root to do this, just a working ADB connection. No additional on-phone software is required.
Code:
$ pm getInstallLocation
0[auto]
$ pm setInstallLocation 2
$ pm getInstallLocation
2[external]
Yep, that's it -- you just set the phone to use external storage for apps. Now when you go to manage your apps, the "Move to SD card" button is enabled for your apps (at least the user-installed ones).
You don't have to pm getInstallLocation -- It just confirms how things are set.
Simple? You bet!
If you look at the file system, you see these moved apps mounted through a loop device, just line any other natively moved app.
Since I'm risk adverse, I set things back the way they were before going on.
Code:
$ pm setInstallLocation 0
$ pm getInstallLocation
0[auto]
Unfortunately, I was unable to do it through Android Terminal Emulator. Apparently the permissions of the shell there aren't as "good" as the ones provided by ADB.

It works for most of the apps!! but still i am unable to move flash player (12mb), maps(9.45mb) etc...

s.rajkumar said:
It works for most of the apps!! but still i am unable to move flash player (12mb), maps(9.45mb) etc...
Click to expand...
Click to collapse
I did move them to SD, but I had to uninstall them first with Titanium Backup, then reinstall from the Market (they both had to go into phone memory first), and only then set setInstallLocation to 2 and was able to do the move.

nice find
but i think u need to be root for it as when you type command i am getting "permission denied"
edit.... i looks like terminal emulator problem....

Related

(How-to) prevent Android Market app from updating itself

UPDATE: try this simpler method first: http://forum.xda-developers.com/galaxy-y/general/trick-how-to-disable-google-play-store-t2951378
BEFORE REPLYING: please know that I have tried all of the standard suggested solutions to prevent Market from updating, including freezing Market Updater, using pm disable on it, and turning off auto-updates for apps, and these do not work on Market versions >= 3.0.
On my Samsung Galaxy S2, the latest market app (3.4.4) randomly freezes my entire phone, causing me to have to hold the power button down to reboot. Happens nearly every time I browse for apps in that version. I can "uninstall updates" to get back to the version in /system, but it updates itself to 3.4.4 every time I run it. My goal: prevent the automatic updates.
Plenty of threads here and elsewhere have tips for preventing the updates. The problem is that none if them work for market versions beyond 3.0. I've discovered a method for preventing the updates even on more recent market versions.
Do "uninstall updates" on the market app (in "manage applications").
Open the terminal app.
Run "su" to become root.
Run: touch /data/app/com.android.vending-1.apk
Run: chattr +i /data/app/com.android.vending-1.apk
This will put a bogus APK file in the way of where Android wants to put the new version. The chattr command makes the file "immutable", so that even root can't remove it. Just setting it read only with chmod isn't enough.
This will pin your market to the version included in your ROM. This trick might work if you want to pin a version that's already in /data/app, if you skip the "uninstall updates" and the "touch" command... Haven't tested this.
I tried it, but it said "chattr: command not found".
lexelby said:
On my Samsung Galaxy S2, the latest market app (3.4.4) randomly freezes my entire phone, causing me to have to hold the power button down to reboot. Happens nearly every time I browse for apps in that version. I can "uninstall updates" to get back to the version in /system, but it updates itself to 3.4.4 every time I run it. My goal: prevent the automatic updates.
Plenty of threads here and elsewhere have tips for preventing the updates. The problem is that none if them work for market versions beyond 3.0. I've discovered a method for preventing the updates even on more recent market versions.
Do "uninstall updates" on the market app (in "manage applications").
Open the terminal app.
Run "su" to become root.
Run: touch /data/app/com.android.vending-1.apk
Run: chattr +i /data/app/com.android.vending-1.apk
This will put a bogus APK file in the way of where Android wants to put the new version. The chattr command makes the file "immutable", so that even root can't remove it. Just setting it read only with chmod isn't enough.
This will pin your market to the version included in your ROM. This trick might work if you want to pin a version that's already in /data/app, if you skip the "uninstall updates" and the "touch" command... Haven't tested this.
Click to expand...
Click to collapse
I've had the same problem and this looks quite promising, but I have the same problem w/ chattr not found. What terminal app are you running?
Oops, should have mentioned... You'll need busybox installed. It'll include the chattr command.
lexelby said:
On my Samsung Galaxy S2, the latest market app (3.4.4) randomly freezes my entire phone, causing me to have to hold the power button down to reboot. Happens nearly every time I browse for apps in that version. I can "uninstall updates" to get back to the version in /system, but it updates itself to 3.4.4 every time I run it. My goal: prevent the automatic updates.
Plenty of threads here and elsewhere have tips for preventing the updates. The problem is that none if them work for market versions beyond 3.0. I've discovered a method for preventing the updates even on more recent market versions.
Do "uninstall updates" on the market app (in "manage applications").
Open the terminal app.
Run "su" to become root.
Run: touch /data/app/com.android.vending-1.apk
Run: chattr +i /data/app/com.android.vending-1.apk
This will put a bogus APK file in the way of where Android wants to put the new version. The chattr command makes the file "immutable", so that even root can't remove it. Just setting it read only with chmod isn't enough.
This will pin your market to the version included in your ROM. This trick might work if you want to pin a version that's already in /data/app, if you skip the "uninstall updates" and the "touch" command... Haven't tested this.
Click to expand...
Click to collapse
Ok, I'm back to version 3.1.3. I really hope this works! This market freeze problem has been driving me nuts. This has been the first time I've become overly frustrated with Android. If a version of the market isn't working correctly on our phones, we should be able to run whatever version of the market we want without it automatically updating and forcing you to use the latest version.
Oh!! You have the freezing too? I searched all over but I couldn't find anyone else describing the same freezes. What device/ROM are you on?
lexelby said:
Oh!! You have the freezing too? I searched all over but I couldn't find anyone else describing the same freezes. What device/ROM are you on?
Click to expand...
Click to collapse
I'm currently on CM7 using the AT&T Galaxy S2. I try MIUI from time to time to see if the issue has been resolved, but it hasn't. I had my first market lockup on CM7 today. It's been frustrating the living hell out of me. I tried your suggestion and the market still updated. Hasn't locked up yet, but I haven't spent a lot of time on my phone either.
Any other alternatives? Did the proposed solution work for you?
Sounds like you and I have the exact same phone, carrier, and ROM. The fix did work for me... Hasn't updated since. Maybe try removing Market Updater with Titanium Backup too. Perhaps it falls back to that to update if the builtin mechanism fails... Not sure. You could also try the process again, but be super sure you close Market, "uninstall updates", and then do the touch and chattr. If all else fails you could take a screen video (can we do that on Android?) and I'll watch to see if maybe there's a step I missed.
Also, after going through the steps, run these and paste in the results:
ls -l /data/app/com.android.vending-1.apk
lsattr /data/app/com.android.vending-1.apk
Ok, I'm going to try all of this later today when I get a chance. Will post back with an update asap.
Also, do you remember the results that came up after running every command? I'm going to try to post everything that comes up so you can take a look for yourself.
How long have you been running the market without it updating? I know quite a few people that could benefit from this if it works consistsntly. We are not some rare group. This is a pretty widespread issue here.
Sent from my SGH-I777 using Tapatalk
My market's been on version 3.1.3 since the day before I posted this thread, and it hasn't updated at all. I really think we can get this working for you too... We just need to figure out if I forgot to include a step. The two commands both actually give no feedback at all, so the ls and lsattr will tell us whether things worked properly.
So this problem is widespread? My Google-fu fails me, apparently. Is it just sgh-i777 users on cm7?
Here are my results. Note, the first time I did this, after one of the steps, I got something "not found." I don't remember what it was. But anyways:
$ export PATH=/data/local/bin:$PATH
$ su
# touch /data/app/com.android.vending-1.apk
# chattr +1/data/app/com.android.vending-1.apk
BusyBox v1.19.3 (2011-11-22 01:37:10 MST) multi-call binary.
Usage: chattr [-R] [-+=AacDdijsStTu] [-v VERSION] [FILE]...
Change file attributes on an ext2 fs
Modifiers:
- Remove attributes
+ Add attributes
= Set attributes
Attributes:
A Don't track atime
a Append mode only
c Enable compress
D Write dir contents synchronously
d Don't backup with dump
i Cannot be modified (immutable)
j Write all data to journal first
s Zero disk storage when deleted
S Write file contents synchronously
t Disable tail-merging of partial blocks with other files
u Allow file to be undeleted
-R Recurse
-v Set the file's version/generation number
# ls -l/data/app/com.android.vending-1.apk
ls: invalid option -- /
BusyBox v1.19.3 (2011-11-22 01:37:10 MST) multi-call binary.
Usage: ls [-1AaCxdLHRFplinsehrSXvctu] [-w WIDTH] [FILE]...
List directory contents
-1 One column output
-a Include entries which start with .
-A Like -a, but exclude . and ..
-C List by columns
-x List by lines
-d List directory entries instead of contents
-L Follow symlinks
-H Follow symlinks on command line
-R Recurse
-p Append / to dir entries
-F Append indicator (one of */[email protected]|) to entries
-l Long listing format
-i List inode numbers
-n List numeric UIDs and GIDs instead of names
-s List allocated blocks
-e List full date and time
-h List sizes in human readable format (1K 243M 2G)
-r Sort in reverse order
-S Sort by size
-X Sort by extension
-v Sort by version
-c With -l: sort by ctime
-t With -l: sort by mtime
-u With -l: sort by atime
-w N Assume the terminal is N columns wide
--color[={always,never,auto}] Control coloring
# lsattr /data/app/com.android.vending-1.apk
--------A---- /data/app/com.android.vending-1.apk
#
I just looked at the options and it looks like I inserted an "L" instead of "I" to make the file immutible. Correct? Let me know if I did something wrong so I can go back and try again.
Aha! Now we're getting somewhere. The command should be... "chattr space plus lower-case I space /data/app/com.abdroid.vending-1.apk"... that's "vending dash one dot apk". The ls command is "ell ess space dash ell space /data/app/com.abdroid.vending-1.apk". Can you just copy/paste the commands from the OP?
lexelby said:
Aha! Now we're getting somewhere. The command should be... "chattr space plus lower-case I space /data/app/com.abdroid.vending-1.apk"... that's "vending dash one dot apk". The ls command is "ell ess space dash ell space /data/app/com.abdroid.vending-1.apk". Can you just copy/paste the commands from the OP?
Click to expand...
Click to collapse
Well I'll be damned! I'm going to give this a try.
Do avoid spelling android as "abdroid" like I did, though
lexelby said:
Do avoid spelling android as "abdroid" like I did, though
Click to expand...
Click to collapse
Lol.
Ok, I think I got it. Take a look.
$ export PATH=/data/local/bin:$PATH
$su
# a/app/com.android.vending-1.apk
# a/app/com.android.vending-1.apk
# ls -l data/app/com.android.vending-1.apk
-rw-rw-rw- 1 0 0 0 Jan 11 16:06 data/app/com.android.vending-1.apk
# lsattr data/app/com.android.vending-1.apk
-----i--A---- data/app/com.android.vending-1.apk
#
Don't know why some of it's cut off. I'm not a terminal emulator expert.
That looks right. Now run Market. It should be at 3.1.3, and if you close it, wait a minute, and reopen it, it should still be 3.1.3. If it's updated, then I guess we go back to the drawing board...
Ok ,I ran it and restarted it and it's still the same. Now keep in mind, I did this several times yesterday and about an hour later when I launched the market, it updated. Oh, while I have it in mind, let me freeze market updater, just to eliminate all possible causes. If this works, I owe you a beer! You just have no idea how frustrated I've been over the past month with this issue!
And for the record, type "android market freezes phone" in google search and see for yourself. We are NOT the only ones.
Oh trust me, I know just how frustrated you've been I was really starting to get pissed off at having to "uninstall updates" to safely use the market. I also think the freezes and resulting hard reboots caused the filesystem corruption that forced me to have to restore to factory and restore all of my apps from Titanium. That sucked.
i have another work around that might work. so far its sticking for me.
since the steps from OP is to prevent market from updating and staying at 3.1.3, i downloaded market 3.1.3.apk from here.
i went into root explorer and renamed 'vending.apk' to 'vending.apk.bak'. i didnt delete it incase if anything. just renamed as a backup.
i used tibu to freeze 'market updater'.
i copied market 3.1.3 apk into /system/app and set permission to rw-r-r.
reboot.
so far its working fine for me and its staying at 3.1.3. not sure for how long.

[Q] Mounting file system, copying *.apks...

Hi all!
I've already written some little apps for Android and so I'm planning to create my first 'useful' app. But I'm undecided yet if there should be a PC- or Android-version.
One important thing: I don't ask for compile-ready code or anything, just how to do it the best way.
What should it do?
The user has some checkboxes where he can check if the filesystem should be mounted, if *.apks should be deleted (how can I get a list of all installed *.apk-files on the phone?) and so on.
If making a version for the PC I think there could be a lot of problems with ADB (on my notebook it's running fine, but other users could run in trouble, couldn't they?).
So my preferred way to go would be an Android-app. But how can I execute the commands the user checked? I know how to create text-files on the phone and how to read the content, but not how to execute commands like su, rm, mount -o and so on.
Could you just help me with this little point?
Thanks in advance,
Lunch
Nobody?
For listing apps installed, you can use the command "pm list packages". That'll give you package names. You can then use "pm uninstall {package name}" to uninstall them.
For running shell commands in apps, here's some info: http://stackoverflow.com/a/5686992
http://stackoverflow.com/a/6809955
https://code.google.com/p/market-enabler/wiki/ShellCommands
Hopefully seeing as you know a bit of Java programming the info at these links will make sense to you.
Thank you! Java is not a big problem, but it's my first combination of Java & Android.
So I'll try it and maybe I can make a runable and non-buggy program out of it.

Essential Layout Whitelist Editor

This is an app made by a reddit user to manage the ESSENTIAL_LAYOUT_WHITELIST setting.
You can use this app to only whitelist apps that you need, instead of whitelisting all apps.
Note that you will still need ADB to grant permission to this app:
adb shell pm grant in.tsdo.elw android.permission.WRITE_SECURE_SETTINGS
You only need to do this once, then you can use the app normally.
This app only shows user apps. Please do give feedback if you find any system app that behaves differently than it was.
Google Play
Download(Github)
edit: credits to oracleicom
All credit for this app goes to /u/TsFreddie over on the /r/essential subreddit.
Yes. First up Nova!!!
Sent from my PH-1 using Tapatalk
This is now on Google Play: https://play.google.com/store/apps/details?id=in.tsdo.elw
But you still MUST run that permissions code in ADB.
adb shell pm grant in.tsdo.elw android.permission.WRITE_SECURE_SETTINGS
Click to expand...
Click to collapse
I was wondering when will this get posted here since I can't post link.
But, just a heads up: the old package name got suspended by google. So the package name changed, and the ADB command should change correspondingly.
Code:
adb shell pm grant in.tsdo.elw android.permission.WRITE_SECURE_SETTINGS
TsFreddie said:
I was wondering when will this get posted here since I can't post link.
But, just a heads up: the old package name got suspended by google. So the package name changed, and the ADB command should change correspondingly.
Code:
adb shell pm grant in.tsdo.elw android.permission.WRITE_SECURE_SETTINGS
Click to expand...
Click to collapse
I updated the OP with this :good:
This is great !! Is there a reason why essential didn't do this out of the box?
How'd you guys get ADB drivers to work. I can't locate any that'll work for some reason. Could be my current adb drivers are messing with it. It works fine for my LG and Samsung phones but my adb won't show the Essential phone...
gqukyo said:
How'd you guys get ADB drivers to work. I can't locate any that'll work for some reason. Could be my current adb drivers are messing with it. It works fine for my LG and Samsung phones but my adb won't show the Essential phone...
Click to expand...
Click to collapse
Assuming you're on Windows, reboot with driver signing disabled and force update drivers to the one Google distributes with the sdk.
I got some universal ones to work. However, now my issue is that the authorize PC pop up doesn't actually pop up when I connect. I've google and none of the solutions worked... I just want to swap out the app switcher and back buttons... :T
gqukyo said:
How'd you guys get ADB drivers to work. I can't locate any that'll work for some reason. Could be my current adb drivers are messing with it. It works fine for my LG and Samsung phones but my adb won't show the Essential phone...
Click to expand...
Click to collapse
The older minimal adb packages won't work, and the failures look like driver issues.
Get the new adb and try again.
I got it working now. Just had to use another PC.
Deleted
---------- Post added at 06:28 AM ---------- Previous post was at 05:47 AM ----------
this app worked perfectly! Love it when it's using the extra room! Thanks for the help!
So, my question. Since I did the whitelist all (with the *) what's the remove command for that line? so that I can actually use this selective whitelist?
vexx109 said:
So, my question. Since I did the whitelist all (with the *) what's the remove command for that line? so that I can actually use this selective whitelist?
Click to expand...
Click to collapse
Uploading the new list will over write the existing values.
If you want return the value to stock use,
adb shell settings delete global ESSENTIAL_LAYOUT_WHITELIST
After you guys changed permissions, did you get the OTA update no problem? Did the hack stick or did you need to reapply the shell command?
I did the mods via ADB and they have stuck after the upgrade, either that or Essential has added apps to their whitelist as part of this upgrade.
Thank you so much for this easy way to whitelist without having to wait for Essential!!
Curious what other apps you all have white-listed to full screen (I have only done Nova Prime) with good results...
---------- Post added at 07:10 PM ---------- Previous post was at 07:08 PM ----------
TsFreddie said:
I was wondering when will this get posted here since I can't post link.
But, just a heads up: the old package name got suspended by google. So the package name changed, and the ADB command should change correspondingly.
Code:
adb shell pm grant in.tsdo.elw android.permission.WRITE_SECURE_SETTINGS
Click to expand...
Click to collapse
Thank you!
I whitelisted Nova, Textra, calander and instapaper. Thinking of switching to the global whitelist, but haven't done that yet.
This is so much nicer than fighting with the ADB permissions. I kept missing an app here or there editing it manually. Thank you brilliant lovely folks.
bugsy said:
I whitelisted Nova, Textra, calander and instapaper. Thinking of switching to the global whitelist, but haven't done that yet.
Click to expand...
Click to collapse
A few apps don't work properly. Personally I would just use this app and select all by default, then turn off any apps that you notice has glitches as you see them.

Is it possible to return s10e to bone stock state after root/TWRP/lineageOS install?

I remember I was able to do this previously on some galaxy phones/tablets I owned, by flashing stock recovery and factory resetting the phone.
I ask because I was given brand new s10e by my company and I am a no-gapps lineage user currently. I wish to retain such a setup, but I am afraid of tampering with the phone and possibly being charged money if/when I decide to leave the company in the future?
By bone stock I mean to exactly the same state as when I received it- stock system, stock recovery, nothing noticably different? Or how far can I get, at least?
Thank you in advance for any guidance
Depending on your model, you might not even be able to do what you want.
But i see no reason to worry if you can by using Odin and correct firmware after.
But there can be issues such as Snapdragons not exceeding 80% charge (if you even can unlock the bootloader).
Chances are you have to keep it stock and ADB out the apps you don't like.
The phone is going to work better without Lineage unless i've missed that volte is now a go.
mindlery said:
Depending on your model, you might not even be able to do what you want.
But i see no reason to worry if you can by using Odin and correct firmware after.
But there can be issues such as Snapdragons not exceeding 80% charge (if you even can unlock the bootloader).
Chances are you have to keep it stock and ADB out the apps you don't like.
The phone is going to work better without Lineage unless i've missed that volte is now a go.
Click to expand...
Click to collapse
Hi!
I forgot to mention the model- its sm-g970f (exynos)
Can I remove google and samsung apps with adb and return them later without compromising the android system? Do you know of any good guide on how to do this?
As far as I understand you will trip Knox irreversibly if you unlock the bootloader. Hence you cannot get back anymore. The closest you can get to your needs is by disabling most Google and Samsung apps by ADB and install a theme that mimics AOSP. Then, a factory reset will get your device back to its original state. Check https://forum.xda-developers.com/galaxy-s10/how-to/galaxy-s10-s10-debloat-bloatware-t3912073/page40 for more info.
macchio said:
Hi!
I forgot to mention the model- its sm-g970f (exynos)
Can I remove google and samsung apps with adb and return them later without compromising the android system? Do you know of any good guide on how to do this?
Click to expand...
Click to collapse
You can disable any app, including systems apps WITHOUT root by following this guide.
First, make a make a backup list of all your currently installed apps via ADB:
adb shell pm list packages -f >C:\AppList.txt
For example, let's "uninstall" the Samsung Smart Switch app which can be found in the above AppList.txt file as
/system/preload/SmartSwitch/SmartSwitch.apk=com.sec.android.easyMover
Sometimes the app's name matches the package/file name perfectly, sometimes they are a little different and takes a bit of guessing.
The package name of the Samsung Smart Switch app is "com.sec.android.easyMover", with its path and file name "/system/preload/SmartSwitch/SmartSwitch.apk", as you can see at least the path and file name contains the name of the app.
To disable it via the "uninstall" command, enter:
adb shell pm uninstall -k --user 0 <package_name>
Example:
adb shell pm uninstall -k --user 0 com.sec.android.easyMover
OR
adb shell cmd package uninstall -k --user 0 com.sec.android.easyMover
Now, to re-enable the above "uninstalled" apps or any other specific one without a factory reset, simply copy and paste the app's package name from the AppList.txt into this command:
adb shell cmd package install-existing <package_name>
Example:
adb shell cmd package install-existing com.sec.android.easyMover
Simple as that!

Can I install older version of a preinstalled app on a NON-Rooted device?

Is it possible to install a different (older) version of a S Health app – without rooting and patching system with Lucky Patcher or else?
WHY? - Older version of S Health has a feature of SpO2 measurement (oximeter) on S5 while Marshmallow preinstalled S Health does not.
I tried uninstalling the app through adb shell via pm uninstall user 0 yada-yada but even though it looked like it did, I still couldn't install older version
Code:
adb shell via pm uninstall user 0 yada-yada
doesn't physically remove an app, but only hides it to user.
Knowing app's package name you can physically remove it by running
Code:
adb shell "rm -r '/data/app/<PKG-NAME>*'"
But I have a locked non-rooted device... or can I still do it that?
Code:
adb devices
adb shell "rm -r '/data/app/com.sec.android.app.shealth*'"
Also, is the end of the 2nd line correct or there is some typo? (*)
As I can see you have either none at all or only very little knowledge of Linux what Android is based on: the asterisk in the code-line of course isn't a typo, in Linux it represents a wildcard.
I see nothing bad in not knowing deeply Linux for average user. Anyway, thanks. It says "No such file or directory", also tried app-priv folder to no avail. Wherever preinstalled apps hide themselves on Marshmallow, it's not there.
Maybe will need to go asking to Samsung forum on XDA, maybe developers there know more knowledge in Samsung firmwares/ROMs.
AjvarXX said:
I see nothing bad in not knowing deeply Linux for average user. Anyway, thanks. It says "No such file or directory", also tried app-priv folder to no avail. Wherever preinstalled apps hide themselves on Marshmallow, it's not there.
Maybe will need to go asking to Samsung forum on XDA, maybe developers there know more knowledge in Samsung firmwares/ROMs.
Click to expand...
Click to collapse
Exactly, we all start at the beginning.
This might be helpful:
`adb pull` from app data directory without root access
`adb pull` from app data directory without root access - readme.md
gist.github.com
AjvarXX said:
It says "No such file or directory", also tried app-priv folder to no avail. Wherever preinstalled apps hide themselves on Marshmallow, it's not there.
Click to expand...
Click to collapse
My last 2 cents here:
You may check for the app in question is a user-app or not. You do this by running
Code:
adb devices
adb shell "pm list packages -3"
If the app isn't in the list returned then it's not an user-app but a system-app what can't get uninstalled without superuser rights, will say Android must be rooted.

Categories

Resources