Respond Programatically to Android Device Manager (ADM) - Android Q&A, Help & Troubleshooting

I have an Android 6.0 px5 head unit which has the lock screen settings disabled in rom. I tried Google's Android Device Manager to lock the unit remotely, and it just gave me a "lock" screen that can be easily bypassed. Problem is, this screen pops up at ever boot, as soon as Google Play services connects to wifi, and it's just plain annoying.
I've researched this and tried a number of things. Because there are no lock settings, the normal way to resolve this, enter the password on the locked device, won't work. I've tried a number of adb solutions (I am rooted on device), including removing the gesture.key file, issuing commands to the settings.db and locksettings.db databases, setting
Code:
ro.secure=0
in default.prop, and issuing the unlock keyevent ("
Code:
input keyevent 82
"). Nothing works. The only thing I have been able to do is create a script that removes the lock screen from the current window (
Code:
dumpsys window | grep mFocusedWindow
) -- but it still stays in the status bar and comes back every boot.
My question is: Does anyone know how I can programatically, from the Linux command line, issue a command back to ADM that either sends an "unlock" code or sends the password it's expecting or somehow responds in the way it needs in order for it to stop trying to lock my device at every boot?

Related

[Q] Change/remove lock code with internal class or adb shell

Problem:
I'm an app developer. I have one app that let's you lock the device using Device Administration. One of my users had some conflicts with my app and another. He then removed Device Administration and uninstalled my app, rebooted his phone, and now he cannot access his phone.
He of course cannot use my app to change the password now (since it's uninstalled).
His phone is stock 2.2 LG Optimus V, Virgin Mobile, Rooted.
Question:
I'm needing to find a way that my user can now change his lock code.
I need:
1.) to know an internal class (from com.android.internal) that I could use within an app to change the lock code (just like the system settings do).
OR
2.) to know a command I can use with adb shell to remove or change the phone lock code.
OR
3.) to know the location of the file that stores the lock code information.
Any help is greatly appreciated.
I did actually manage to rewrite a couple pieces of my app, install with adb install, then start it with adb shell am start, and re-enable device admin. So I was able to make it work.
This also worked when my user tried it. Problem Solved.

Android reset lock screen

Good morning,
I have the following problem with a tablet of a child's parents bought in December.
The boy was set to release by drawing on the screen. Now after he has made ​​a number of attempts is displayed when the message "Too many attempts to enter the sequence" and requires the google account. The problem is that you do not remember your credentials, or because you do not connect to the wifi network is not able to validate credentials.
To get around this I did the following tests:
1) attempt to enter the recovery mode by pressing volume + and power
2) attempt via adb with the command "adb reboot recovery"
But every time you restart it is as if there is no recovery mode and starts normally and returns the usual screen that asks for credentials.
I also run this procedure:
> Adb-d shell
# Sqlite3 data / data / com.android.providers.settings / databases / settings.db
sqlite> update system set value = 0 where name = 'lock_pattern_autolock';
sqlite>. exit
# exit
but when I reboot I get the same error message with the introduction of the credentials.
Nobody can help me?....:crying::crying::crying:
Go to recovery and restore factory
If USB debugging is active, do this:
Code:
adb shell rm /data/system/gesture.key
let that finish then:
Code:
adb reboot
Your tablet will reboot, and you should be able to enter any code, and it will unlock.
thanks so much, with your help I solved the problem ............................ :good::good::good::good::good:
try to install the application "Screen Lock Reset" from google play
it may do the job for you
yiorgosc said:
try to install the application "Screen Lock Reset" from google play
it may do the job for you
Click to expand...
Click to collapse
without unlocking the phone, yeah right.
Temporarily haven't meet this situation.

How I was able tether without root

Following the instructions from this post (except don't rebook at the end) https://forum.xda-developers.com/showpost.php?p=61736387&postcount=15 I was able to successfully tether on the LG G6 h871. The data flows from phone to whatever wifi device smoothly.
The thing I'm still working on is that the changes don't persist if the phone turns off. The settings reset when the phone is restarted. Anyone know how to make the changes stick?
Thanks!
Here's a brief update.
You can actually make these settings from within your phone, instead of through the ADB command, which is useful in case you suffer an inadvertant reboot while in the field. Still haven't been able to make the settings persist through reboot however.
Taken from here https://forum.xda-developers.com/att-lg-v10/help/activate-hotspot-unlocked-lg-v10-t3585697
You use the Settings Database Editor and find these entries in there (you have to find the one in both the System and Global tables).
The setting in Global table "tether_dun_required 0" is protected and won't let you edit it.
You can change this using ADB, and fortunately granting these permissions is a one time process that does persist through normal reboots. https://forum.xda-developers.com/tm...settings-database-editor-tweaks-t3609876/amp/
"adb shell"
"pm grant by4a.setedit22 android.permission.WRITE_SECURE_SETTINGS" (check this command against the text the app pops up when you try to change the protected setting)
"reboot"
Now you are able to go into the Settings Database Editor app and modify these two settings
Global table "tether_dun_required 0"
System table "tether_entitlement_check_state 0"
And viola you will have a working wifi hotspot on your unrooted stock phone. Hopefully I can figure out a way to make these changes stick through reboots though, because it is a bit of a hassle to click through the app anytime it reboots, but at least it works, and it's certainly better than the popping out your sim card trick and trying to time shoving it back in just at the right moment during the wifi hotspot creation trick.
I used to use this trick but tried the other day and while I was able to connect to the hotspot I could not get internet on any device. Anyone else notice this.
Is this issue specific to the h871 / AT&T? On h870 (carrier free) you can just enable it in settings...
Worked very well for me, thanks! Did you get around these settings stick after reboot?

NavBar Color Change Crashed Phone [S9] (ADB Shell)

So recently i wanted to change my S9 navigation bar color and i tried to use adb shell. All worked fine, i was using these commands:
adb shell
settings put global navigationbar_color <insert value>
settings put global navigationbar_current_color <insert value>
So i read that i if i insert a wrong value then phone may crash and never boot. So I accidentaly pressed CTRL-V (windows cmd prompt) and pressed enter, it didnt paste code but paste ^V symbol instead of color decimal number, so i ended with crashed phone which is not booting now. (Blue led light with samsung logo endless staying on screen).
I really need help to recover all this. I dont want to reset my phone, i want just to change that value back to proper number, but i cant find a way to do. Tried to access phone storage to use sqlite3 on file where global setting is stored, but phone not showing in windows explorer or samsung smart switch.
I just want to find these two strings and add the old value back to them. I dont want to reset phone and loose information just for 2 variables.
P.S. I thought maybe i can create an .apk that change nav bar color's value back and using adb sideload to load it ? I dont know if that's possible.

[Solution] How to Delete Your Android Security PIN & PATTERN

This guide will walk you through deleting your security PIN via several methods. This guide is for those who have forgotten your security PIN and cannot do a Google reset for some reason. Have restored your phone from an old backup that had a different PIN than your current PIN, and now the Android system is completely confused which PIN to use and isn’t accepting any of them.
You should have a custom recovery installed on your phone, or ADB installed on your computer, but that is beyond the scope of this guide as custom recovery installation methods varies by device. Check Appuals for how to install TWRP on your specific device, or how to install ADB on Windows.
There are two situations you may encounter after restoring from a backup that contained a different PIN than the one you are most recently using.
Device Uses Two Different PINs
This will happen when you have a recent boot PIN, and your backup contains an old screen-lock PIN. So now the device will have two different PINs, which may in fact add to overall device security, but be a headache when you need to remember both PINs.
To resolve this you simply need to reset your PIN in the Android settings. Just go to Settings > Security > Screen Lock, and enter a new PIN. It will overwrite the boot PIN and default back to using just one PIN.
The Device Won’t Accept Any PIN
This is where things get frustrating. In certain cases, your phone may accept the boot PIN, but not a screen unlock PIN. For this, we are going to completely delete the files that store your PIN (yes, your PIN is stored in system files that can be deleted – shocking?).
Delete your Android PIN – TWRP Method
Boot your phone into TWRP recovery.
Go to Advanced > File Manager and navigate to /data/system.
Find the files that end in the .key extension and any files that have “locksettings” in the filename. They will typically be (but vary by manufacturer):
Code:
Gatekeeper.password.key
gatekeeper.pattern.key
locksettings.db
locksettings.db-shm
locksettings.db-wal
After you’ve deleted those files, reboot your phone. You will be greeted by a lock screen, but it will not prompt you for any password or PIN. If it does, you did not delete all the necessary files.
Set a new PIN in your security settings!
Delete your Android PIN – ADB Method
Note: This requires a rooted phone and USB debugging enabled. If USB debugging is not enabled and you are locked out of your phone, you need to try and flash a custom recovery such as TWRP, which can also grant an ADB sideloader.
Connect your phone to your computer via USB and launch an ADB terminal.
Type the following commands into the command prompt:
Code:
adb devices
adb shell
cd /data/system
su
rm *.key
rm *.key
adb reboot
Delete your Android PIN – ADB/SQL Method
Note: This is an alternative ADB method for those who have SQLite3 alongside their ADB installation.
Type the following commands into your ADB/SQL terminal:
Code:
adb shell
cd /data/data/com.android.providers.settings/databases
sqlite3 settings.db
update system set value=0 where name=’lock_pattern_autolock’;
update system set value=0 where name=’lockscreen.lockedoutpermanently’;
.quit
Delete your Android PIN – Flashable Pattern Password Disable.Zip Method
Note: This is for those who have a custom recovery (it doesn’t matter which) installed and want to flash a .zip that will do the work for you.
Download the Pattern Password Disable .zip from here and transfer it to your phone’s SD card.
Reboot into your custom recovery of choice.
Flash the zip and reboot your phone.
I have phone that I am and "owner" user. I've created a user accounts for kids. They used fingerprint to unlock the screen for the user account, but then once the phone asked the PIN to "improve" security, but they forget the pin.. of course. It also looks like the phone switched to FBE (file based encryption) with some OS update. Removing locksettings.db makes the phone unbootable, ale also the owner pin disappears. Is there a way how owner can reset the pin for a user?
I have a root also on this device..

Categories

Resources