[TIP/TRICK] - Unlock your adb shell completly - Redmi Note 8 Pro Guides, News, & Discussion

Code:
/*
* I am not responsible for bricked devices, dead SD cards, data loss,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about tips provided here.
* Before making any alteration to your system make sure you know what you
* are doing and have previously made a backup of all sensitive data!
* YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will just laugh at you.
*/
BEWARE THE TIP/TRICKS SHARED IN THIS THREAD CAN LEAD TO MODIFICATIONS TO YOUR OPERATING SYSTEM WHICH CAN SERIOUSLY MESS UP YOUR DEVICE, SOME YOU MIGHT NOT BE ABLE TO RECOVER FROM. BE AWARE OF THIS BEFORE CONTIUE READING
Dear all,
Being new to the Xiamoi/MIUI world I recently found out at the cost of complete data loss needing a full factory restore (EDL), and 3 days to get everything back in order, that adb shell for our device (and all other Mi devices I suppose) are restricted, enbabling ADB debugging and/or being root not being enough.
I thought wrongly being root on the device was enough for doing stuff I needed. I was wrong, so I'll be sharing my findings to avoid any of you going through the pain.
Nothing really extraordinary, many XDA users probably know all this, but new Mi/MIUI users might not, so I'll share anyway.
Best way to verify this is by simply typing from an adb shell / or terminal the following command which normally does not need root on devices but on Xiaomi needs elevated (Mi) permissions from shell (which are restricted by default) :
Code:
begonia:/ $ wm size
Physical size: 1080x2340
begonia:/ $ wm density
Physical density: 440
If any of those two commands do not display like above the result of your current phone resolution, if it hangs in there displaying nothing or throw you off a security exception like this
Code:
Security exception: Must hold permission android.permission.WRITE_SECURE_SETTINGS
java.lang.SecurityException: Must hold permission android.permission.WRITE_SECURE_SETTINGS
at com.android.server.wm.WindowManagerService.clearForcedDisplaySize(WindowManagerService.java:5706)
at com.android.server.wm.WindowManagerShellCommand.runDisplaySize(WindowManagerShellCommand.java:129)
at com.android.server.wm.WindowManagerShellCommand.onCommand(WindowManagerShellCommand.java:66)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.wm.WindowManagerService.onShellCommand(WindowManagerService.java:1063)
at android.os.Binder.shellCommand(Binder.java:629)
at android.os.Binder.onTransact(Binder.java:527)
at android.view.IWindowManager$Stub.onTransact(IWindowManager.java:1140)
at com.android.server.wm.WindowManagerService.onTransact(WindowManagerService.java:1278)
at android.os.Binder.execTransact(Binder.java:726)
it means your adb shell/terminal user is currently restricted and needs to be unlocked.
So before starting to mess up around with things like your screen resolution for example (which could render your phone completely unusable like i did), first make sure to unlock adb shell from the developer options.
In order to do so you will be prompted to log into your MIUI account.
Do it.
Turn both of the options on
- Install via USB (not exactly needed here, but pretty useful if you want to install/reinstall apps through adb)
- USB debugging
Once this is done and you accepted all the security warning pop ups, you are all set.
You can even log out from your Mi account, settings will stick around.
Hope this helps.

Related

Got a keypad dialing problem - trying to use * * for my office phone system

before with WM5 it worked great, i was able to hit * twice in a row and i would get * *, after the upgrade to WM6, what happens, is when i hit * * twice in a row, the * becomes a "p", previously the "p" would only come up when i hold the *... WM6 works GREAT on the device and i hate to downgrade back, is there any type of solution ?
you just need to wait some 3-4 seconds then type the seconde *.
but if i do that the phone system already doesn't recognize

[Q] Reset screen lock code - no wipe

Hello,
I was given a Galaxy Wonder to repair, the problem is the kid who's phone it is, forgot the lock screen password/code nor did he have a google account on the device. And the best part, is he want's the data!
I would backup and flash the device, but adb commands requiring root privileges won't work directly - it complains that "adbd cannot run as root in production builds"...
I got ADB up and running and installed "su" (root privileges in shell).
I've tried many suggestions with changing and deleting entries in the "data/data/com.android.providers.settings/databases/settings.db" file on the device.
There are no more references left in the "system" or "secure" tables to any kind of "locking". According to many posts the lock screen should not be present after reboot or it should be anything random (or nothing).
Also, I've deleted the gesture and password files from /data/system/...
Nothing has worked to remove the screen lock. Please help.
~confuded

[Q] HTC Vision - How do I enable just wifi access point but not routing?

So, I have had an HTC Vision running CM7 and have been using it as JUST a wifi access point (no routing or DHCP provided by the Vision itself, just the WAP). I could tell you a very long and boring story about why I need it this way but here's the bottom line -- I'd like to know the actual command line (either through adb shell or terminal directly on the device) to configure and enable just the master mode access point functionality with encryption.
I found a starting point on Antoine Amarilli's blog - Android from the Command Line -- not allowed to post links yet or I would -- but two things:
1) it doesn't appear to cover encryption.
2) It requires getting and using an add'l binary (ultra_bcm_config) which is simple enough but slightly puzzling since obviously the phone can do all of this already with just what's in the CM7 ROM.
So I'd just like a little more understanding, control, and insight to be able to script the WAP setup myself instead of being beholden to the built-in tether toggle -- which occasionally fails to work though it's easily fixed with a reboot of the phone.
Guidance? Thanks!

Partial answer/workaround to locked bootloaders?

I have a Galaxy S9+, gm965u. This bootloader will never be unlocked, and I've come to accept that. That being said, I've been playing around with adb pm, disabling and uninstalling packages for user 0. This has been pretty useful, and it gets rid of a lot of crapware from the phone.
This is probably no surprise to a lot of people, but I've found that that I can replace pretty much anything critical on the phone, in terms of functionality, with packages from F-Droid, or compatible AOSP packages via sideloading. (there's one exception, messaging, I'll get to that).
I got to thinking: for user 0, is it possible to just wipe out all/most of the existing software packages, and replace them with AOSP? It seems like this would be mostly safe, since you're just one factor recovery/reset away from restoring the original software load. You could use script with adb to wipe all the user 0 stuff, and then use adb to install an entire new framework. This doesn't need root, gets rid of all the samsung crap for the current user (you), and lets you run pretty much anything you want.
For sure, you won't be able to mess with the kernel, and maybe you can't override certain packages that run at a lower level. I've also found that MMS gets broken somehow, and I can't send images via MMS. There may be a few other things, I've been a little conservative/careful so far.
Is there some important point or technical issue I'm missing here? The process would be:
* Start with stock o/s, factory reset
* go through initial setup of phone, skip everything
* enable developer mode and adb
* adb uninstall everything for user 0
* adb install aosp packages for user 0
* reboot/profit
feedback welcome!

Spyware of Phone

Hello,
I'm hoping that someone here will be able to help to do one or more of the following things:
1) Complete data recovery of Samsung Galaxy S9 snapdragon
2) Bypass pattern lock
A partner against whom I have a restraining order purchased this phone for me and I have since become aware that there is software installed on it which I cannot access which is recording my location, communications, etc.
All I installed is Mxplorer, OS Monitor, and Logcat, all of which were recommended by users on these forums and which were Google Play verified. When I started going through what I could access and recording the logs, my phone went crazy and a bunch of root files began to delete themselves. Now it is locked by a pattern and I never set a pattern.
Is it possible for me to bypass this pattern without deleting all the data on the phone, or to backup all the data on the phone including root files even if I cannot download the phone itself?
Alternatively, is anyone aware of any organization that would help me to examine the phone, as I do not feel that I have the technological ability to do so myself?
Also, I understand that the best thing to do for my own security is to use a different phone and to reset the passwords for all the accts that were saved on that phone from a different device and I am already doing that but it is very important to me to identify and preserve the spyware that was installed on this phone in order to 1) ensure the continuation of the restraining order 2) know what information he has had access to and 3) share the information that I find with organizations that are involved in combatting the development/sale/use of this kind of stalkerware.
Thank you.
PS C:\Users\Genevieve\Desktop\platform-tools_r30.0.5-windows (1)\platform-tools> .\adb shell
starqlteue:/ $ cd /data/data/com.android.providers.settings/databases
/system/bin/sh: cd: /data/data/com.android.providers.settings/databases: Permission denied
2|starqlteue:/ $
2|starqlteue:/ $
This is what I'm coming up against when I try to bypass the screen lock using adb, just for reference.
Permission denied on that path is not unusual, some devices simply don't support accessing that path over ADB. To delete that path, USB debugging needs to have already been enabled in the device's developer options so you can delete the gesture.key file and regain access. I've had a similar fight with an older Android device, trying to retrieve photos from a phone with an unlock pattern the owner had forgotten.
In the end I managed to gain access to the filesystem, but I had to do it through recovery mode by flashing an alternative recovery image to the device which bricked it for normal use.
I'd be surprised if this other person managed to install commercial spyware/malware without rooting the device, which would also give you access to that path.
That sort of 0day vuln is either darknet for $$$ (at which point, just wipe the cache partition, reflash the stock firmware and start from scratch) or nation state actor complexity.

Categories

Resources