Device Owner already set - Moto Z4 Questions & Answers

I'm trying to set up a package to be device owner
adb shell dpm set-device-owner com.pdp.deviceowner/.receivers.AdminReceiver
But, i'm getting an error
java.lang.IllegalStateException: Not allowed to set the device owner because there are already some accounts on the device
at android.os.Parcel.createException(Parcel.java:1958)
at android.os.Parcel.readException(Parcel.java:1918)
at android.os.Parcel.readException(Parcel.java:1868)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:5863)
at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:176)
at com.android.commands.dpm.Dpm.onRun(Dpm.java:106)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:54)
at com.android.commands.dpm.Dpm.main(Dpm.java:41)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.devicepolicy.DevicePolicyManagerService.enforceCanSetDeviceOwnerLocked(DevicePolicyManagerService.java:7942)
at com.android.server.devicepolicy.DevicePolicyManagerService.setDeviceOwner(DevicePolicyManagerService.java:7232)
at android.app.admin.IDevicePolicyManager$Stub.onTransact(IDevicePolicyManager.java:1095)
at android.os.Binder.execTransact(Binder.java:746)
There are no accounts on the device, i did a factory reset.
I have a verizon z4. is this the problem? is anyone else having a problem with an 'Unlocked' version?

Get a root shell using ADB and check the contents of your device_policies.xml (and device_owner.xml) files.
Code:
cat /data/system/device_policies.xml
Code:
cat /data/system/device_owner.xml
You want to check if there is an active admin or owner set for your device. If you cannot find this app enabled as admin in settings (Settings > Security > Device admin apps), you can remove this app using ADB.
Because you already have a device owner, you cannot set a different device owner until all accounts are removed and no active admin application owns your device.

Related

[Hack] remove a lockscreen pin via adb with sqlite3

There are a couple other ways posted for folks who have forgotten lockscreen password or pattern, but this methods REMOVES the PIN. for pattern and password follow other methods
This method requires root access and debugging enabled.
*if debugging is not enabled it can be done from any custom recovery
-reboot recovery and follow code
PIN
Code:
adb shell
# sqlite3 /data/data/com.android.providers.settings/databases/settings.db
sqlite> update secure set value=65536 where name='lockscreen.password_type';
sqlite> .exit
# exit
adb reboot
step one
Code:
adb shell
make sure you have # in the command prompt/terminal (if not type su)
step two
Code:
sqlite3 /data/data/com.android.providers.settings/databases/settings.db
you will now see sqlite>in command prompt/terminal
step 4
Code:
update secure set value=65536 where name='lockscreen.password_type';
still sqlite>
step 5
Code:
.exit
you will see the # again
step 6
Code:
exit
you will now be in the path/to/adb command prompt/terminal again
step 7
Code:
adb reboot
Enjoy full access to the device
Now lets say you think your wife is cheating on you (which she probably is) and you want to check her sext messages but return the PIN back when you are done.
Code:
adb shell
# sqlite3 /data/data/com.android.providers.settings/databases/settings.db
sqlite> update secure set value=131072 where name='lockscreen.password_type';
sqlite> .exit
# exit
adb reboot
I find this a bit scary, how would you normally prevent ADB or Recovery hacking like this if your device gets stolen?
BrotherG said:
I find this a bit scary, how would you normally prevent ADB or Recovery hacking like this if your device gets stolen?
Click to expand...
Click to collapse
I recommend Avast Anti Theft.
When your device gets stolen, the new owner will take the sim card out and put his in huh?
Well, anti theft sends a pre-entered number a warning that an other SIM is in it. Via sms commands, you can turn GPS on, send the location, block root and stuff.
It wont be deleted as it is a system app
I use it.
Thanks for the job, needed this for hacking my bros phone xD
Greets!
hahaha. .... these Feds could of used this method. They couldnt get past the lockscreen. Great read here.
How a Pimp’s Android Pattern Lock Foiled the Feds
http://gizmodo.com/5893410/how-a-pimps-android-pattern-lock-foiled-the-feds
Looks like CyanogenMod is working on securing ADB
Security and You
March 16th, 2012
jeagoss
1
Many of you may not give it a second glance, but among all the furor and concern about permissions requested by market apps and privacy, all Custom ROMs (CyanogenMod included) ship with one major security risk — root!
We have been struggling with how to handle this for quite a bit, and took a first step with the first public CyanogenMod 9 alpha builds, by disabling the previously-default root access over USB. You can still get adb root access by running “adb root” in terminal, should you ever need it.
We recently merged 3 patches into CyanogenMod 9, to further address this: http://goo.gl/eCjDV http://goo.gl/oWAFI and http://goo.gl/34vai.
What follows is an explanation of the changes, how they affect you and our reasoning behind them.
What do the patches do?
They disable root selectively and in a configurable way. Users will be able to configure their exposure to root as:
Disabled
Enabled for ADB only
Enabled for Apps only
Enabled for both
How does this change affect the usage of your device, and root apps you have installed?
On a default CyanogenMod installation, root usage will have to be explicitly enabled by the user. This means that the user is fully aware that any application that uses root may perform actions that could compromise security, stability and data integrity. Once enabled, the process mirrors that of the current process, apps that request root will be flagged by the SuperUser.apk and the user will have to grant selective access.
Why the change?
At CyanogenMod, security has always been one of our primary concerns, however, we were hesitant to make a change that might disrupt the current root ecosystem. With CyanogenMod 9 we have the opportunity to do things better, whether its the code in the OS, UI/UX, or security – we are taking this time to do things with a fresh approach.
Shipping root enabled by default to 1,000,000+ devices was a gaping hole. With these changes we believe we have reached a compromise that allows enthusiasts to keep using root if they so desire but also provide a good level of security to the majority of users.
What concerns remain?
Many of you reading this are savvy enough to note a remaining hole in this approach – recovery and unlocked bootloaders. The bootloaders are out of our hands, there is little to nothing we can do on that front.
Regarding recovery – with unlocked bootloaders, a malicious user could just flash a new recovery image (without any potential security we could apply) or just dump the data partition. This however, requires physical access to the device. As such, the security standards for this are highly reliant on you, the device owner. Data encryption is available in ICS to safeguard your data. (Warning for emmc only users – encrypted /data means recovery will be non-functional.)
The onus is on you to secure your device; take care of your possessions, and this risk is minimal. Always make sure you take devices out of your car before you go into the mall and remove them from pockets before washing laundry. Common sense is a basic security tool.
But Why?
We honestl
Click to expand...
Click to collapse
Source: http://www.cyanogenmod.com/blog/security-and-you
mDroidd said:
I recommend Avast Anti Theft.
When your device gets stolen, the new owner will take the sim card out and put his in huh?
Well, anti theft sends a pre-entered number a warning that an other SIM is in it. Via sms commands, you can turn GPS on, send the location, block root and stuff.
It wont be deleted as it is a system app
I use it.
Thanks for the job, needed this for hacking my bros phone xD
Greets!
Click to expand...
Click to collapse
All true, if speaking of a casual thief- maybe you left the phone on the bar and someone couldn't resist the temptation. A couple of months ago my wife's phone was recovered in such an occasion- got an sms from Avast Theft Aware with the new number, contacted the rather surprised "honest finder" and he decided to return it back to us.
Anyway, two weeks ago went scubadiving and when returning to the car found the window broken and sure, among other stuff (wallets, scuba gear etc) also both our phones were stolen. However, this time it looks like the thieves were not quick to put their own sim card. Actually, it looks like they've removed the batteries, thrown the sim cards away (the're useless anyway as the carrier blocks the sim).
Since then, no signs whatsoever that the phones have been turned on, sims replaced or that someone has tried to type wrong security pin or whatever- no sms notifications, no emails, no webtracking, nothing.
My guess- the thieves sell them for a small fee (20% of street price?) to some lab or someone who knows "how to deal with it"- do a good wipe (not just factory reset) and remove whatever stuff was installed- system app or not- then put them on market for sale as second hand. Or maybe they just wait with patience a few weeks until you stop looking for it?
So, sometimes these apps like Avast, Cerberus and the such work, sometimes not. Better to keep the phone safe and not rely on it being stolen by a stup!d thief...
On the bright side, one can consider it as an opportunity for upgrade
irst I typed in :
sqlite3 /data/data/com.android.providers.settings/databases/settings.db
However, in spite of what he stated, sqlite>in command prompt doesn't appear.
Instead, I get
/system/bin/sh: sqlite3: not found
how do i set sqlite working?
I'm unable to launch sqlite3 from adb shell
I can manually launch sqlite from the folder but not in cmd
You have to install sqlite3 - https://play.google.com/store/apps/details?id=ptSoft.util.sqlite3forroot&hl=en
Is there a tutorial for a password locked screen too?
Is there another way to bypass the pin code lockscreen? Cus´ I´m always stucking on:
" /sbin/sh: sqlite3: not found "
I have installed sqlite from market
any idea?
whoa, you guys are amazing, this worked like a charm on a password locked tablet
polaroid pmid70c
this is a scary concept if you value your android device consider installing a paid service like dyndns and install the paid version of real vnc onto the device and have ssh setup as well this would help to recover your phone in the event it becomes stolen you could ssh into it launch apps view and control the phone remotely via vnc hell even take pictures ,, turn on gps all sorts of cool things
holm94 said:
Is there another way to bypass the pin code lockscreen? Cus´ I´m always stucking on: " /sbin/sh: sqlite3: not found " I have installed sqlite from market
Click to expand...
Click to collapse
your phone is root enabled? Superuser or SuperSU app installed? Connect USB and run "adb root" and that works?
Try this installer app again https://play.google.com/store/apps/details?id=ptSoft.util.sqlite3forroot&hl=en
I flashed the root feature with SuperSU update zip file in recovery mode, and rebooted.
I grabbed a 'sqlite3' binary made for ARM cpu from the 'net and manually pushed it to my phone's /system/xbin/ directory.
1. unzip this sqlite3 file
2. power on device in custom recovery mode, ('factory mode' also may work, such as in some chinese phones, including my Jiayu)
3. connect USB cable, and in recovery mode, mount the /system directory and any other directorys you will use (see screenshot)
4. open a command prompt (terminal) on computer and run these commands
Code:
[I]adb root[/I]
[I]adb remount[/I]
[I]adb push sqlite3 /system/xbin/sqlite3[/I]
[I]adb shell[/I]
[I]chmod 755 /system/xbin/sqlite3[/I]
[I]sqlite3 -h[/I]
...
exit
adb reboot
* alternate method: if #4 'adb root' does not work, then turn on phone to normal running mode and do:
Code:
adb push sqlite3 /data/local/tmp/sqlite3
adb shell
su
mount -o rw,remount /system
cp /data/local/tmp/sqlite3 /system/xbin/
rm /data/local/tmp/sqlite3
chmod 755 /system/xbin/sqlite3
sqlite3 -h
...
exit
exit
adb reboot
"exit" twice for alternate method.
All this can be done over Wifi instead of USB via a SSH server app.
^_^
I can run all the commands fine, but the PIN lock is still there on my phone after reboot. Android 4.2.1, Jiayu Chinese ROM. So method does not work.
help me, im stuck at " error: device unauthorized. Please check the confirmation dialog on your device."
I know this is super old thread but I used this method and combination with other commands I found on internet to bypass my lockscreen on att samsung galaxy s7 phone I had forgotten pin code on.
I was using fingerprint for a couple of months and rebooted phone for an update and it requires pin code first time before using fingerprint again and I had flat out forgot it. When it got to 1 hour wait between input retrys I searched and found this and other methods. I read no methods work unless rooted.
Luckily and thank God I'm rooted and usb debugging turned on and I have adb installed configured and have used with phone before....thank God. Because pretty much every and anything else on the phone is turned off on phone so I keep off the grid.
I know I'm dragging this out but I want to document and reiterate the value of xda. I will try and remember exactly what I did and may just redo it to be sure and list my exact steps.
One thing, I don't have sqlite3 curser when connecting with adb....I have hero2qltatt or something like that .....I'll get corrected with an edit when I go thru again to make sure.
Also, once I got past lockscreen, when I went into setting/lockscreen&security/ on the phone it still showed pin,fingerprint as security but somehow which still baffles me there was a pick for 'swipe' available....but I still don't know how that happened or how it appeared but I kept trying different pin codes to try to reset that which now there were no limits or time delays but still couldn't remember and then I saw a pick for 'swipe' and that solved it all. I rebooted again to be sure and perfect. Then I went in to recovery and wiped cache and now my phone is back exactly as before.
I wrote down the pin code this time.
Eventually soon I will rerun my steps and document exactly and maybe there is already a more recent account but I found this one first and it pretty much worked....thanks.
OK this is what I used:
adb shell
cd data/system
su
rm *.key

reboot

[NO ROOT][OOS10.3.3] Using ANY app parallelly without Parallel Space or Parallel Apps

I moved to ProtonMail from GMail a few years ago due to privacy issues. But ProtonMail app on android has always lacked a very important feature. Multiple accounts.
Parallel Apps on OOS and Parallel Space do exist, but I have never been able to add more than a few basic apps in it. But i figured something out that works for me. There might be other ways, but this is what I have done.
Phone tested here: OnePlus 7 (OOS 10.3.3). Should work for most other phones.
Prerequisites:
1. Backup. Always backup your phone before trying anything new.
2. ADB.
3. Aurora app store apk file. [You can finf the apk on the official XDA Thread for the app]
Process:
1. Connect the Phone to the computer and check whether adb is setup properly. If there is a device, it is connected properly and you can continue.
Code:
[email protected]:~$ adb devices
List of devices attached
24b61df3 device
2. Now that its connected, we need to access the adb shell.
Type adb -d shell to access the android shell and execute the rest of the steps.
Code:
[email protected]:~$ adb -d shell
OnePlus7:/ $
3. Create a new user. Put your desired username instead of <username>
Code:
OnePlus7:/ $ pm create-user --profileOf 0 --managed <username>
Success: created user id 10
If successful, the ID of new user (usually 10 or above) will be displayed.
You can check if the user was successfully created by execute:
[cods]
OnePlus7:/ $ pm list users
Users:
UserInfo{0wnerr:13} running
UserInfo{10:<username>:20} running
[/code]
4. Start the new created user
Code:
OnePlus7:/ $ am start-user 10
Success: user started
5. In a few seconds, you can see a work profile in the application drawer.
Reboot the phone.
Basically you have an entire set of new apps in this new profile (with a briefcase sticker on the icon), including a new Play Store, and all other system apps. And there is no need to logout and login between profiles anymore.
6. Now you can install apps on this user using:
Code:
adb install --user <user id> <package name>
7. Sadly due to a bug in Play Store, if you try to download apps in the new profile that already exist in the root profile, it gives you an error.
Fortunately there is a work around. We install the completely safe and open source Aurora store app.
Code:
adb install --user <user id> aurora.apk
You can now use this store to download any app and create a second account.
Alternatively, you can also download the apks from apkmirror and install them using adb.
Pro Tip: To make things easier, go to Settings -> Apps & Notifications -> See All -> Filter using “Work” and then disable all the system apps that you dont need, like OG Play store, since it wont work anyway.
So you just took this already existing Guide and pasted here without providing the source?
https://www.xda-developers.com/add-any-app-oxygenos-parallel-apps-space-oneplus-phones/
Aswin08 said:
So you just took this already existing Guide and pasted here without providing the source?
https://www.xda-developers.com/add-any-app-oxygenos-parallel-apps-space-oneplus-phones/
Click to expand...
Click to collapse
This guide is different. Does not create a seperate section (work profile)
It installs apps in the normal app drawer with a small badge to differentiate. What i explained creates a seperare app drawer alltogether. Plus that article has not worked for me on 3 oneplus devices that I tried. Hence i did not say that i was inspired by that article.
But if it is still required, I will mention it.
metal_head1 said:
This guide is different. Does not create a seperate section (work profile)
It installs apps in the normal app drawer with a small badge to differentiate. What i explained creates a seperare app drawer alltogether. Plus that article has not worked for me on 3 oneplus devices that I tried. Hence i did not say that i was inspired by that article.
Click to expand...
Click to collapse
Okay, fine thn. :good:

How do I set the Device Owner? (adb) - To disable system apps

Hi,
I was wondering if anyone has managed to set the device owner for the find x2 pro? I tried using package disabler pro, but it keeps complaning about not having device owner access. It says to run thus via adb:
Code:
adb shell dpm set-device-owner com.pdp.deviceowner/.receivers.AdminReceiver
after running this, it does not work and get this erro
Code:
java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device
at android.os.Parcel.createExceptionOrNull(Parcel.java:2397)
at android.os.Parcel.createException(Parcel.java:2373)
at android.os.Parcel.readException(Parcel.java:2356)
at android.os.Parcel.readException(Parcel.java:2298)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:8665)
at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:203)
at com.android.commands.dpm.Dpm.onRun(Dpm.java:115)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:60)
at com.android.commands.dpm.Dpm.main(Dpm.java:41)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.devicepolicy.DevicePolicyManagerService.enforceCanSetDeviceOwnerLocked(DevicePolicyManagerService.java:9668)
at com.android.server.devicepolicy.DevicePolicyManagerService.setDeviceOwner(DevicePolicyManagerService.java:8702)
at android.app.admin.IDevicePolicyManager$Stub.onTransact(IDevicePolicyManager.java:3582)
at android.os.Binder.execTransactInternal(Binder.java:1161)
at android.os.Binder.execTransact(Binder.java:1130)
I also deleted all my accounts associated to the device and still no joy
I wanted to disable some system apps, to see if I can figure out what is preventing apps to be clocked at 60hz. I know coloros whitelists certain apps, so i thought it maybe a system app that is doing this and eliminate them one by one.
Have you selected the option Disable Permission Monitoring in Developer options?

ADB change bluetooth_name not working

Hello,
I am working on a script to provision many android tablets using adb via usb.
The devices all have root access and android 8.1.0.
Some settings I need can be changed using the settings stored in /data/system/users/0/settings_global.xml
i.e.
Code:
adb shell settings put global bluetooth_on 1
However changing the "device name" which is the bluetooth_name stored in /data/system/users/0/settings_secure.xml does not work.
This is the line:
<setting id="218" name="bluetooth_name" value="tablet-99" package="android" defaultValue="tablet-99" defaultSysSet="true" />
Code:
adb shell settings put secure bluetooth_name "tablet-77"
--> this just changes the value and not the defaultValue (how to do this?) ... both settings are reset after reboot
--> changing the file manually via sed/vi is reset after boot
In this thread Cloning Pre-configured Android 8.1 Device / ROM changing settings_secure.xml settings seems to work without problems.
Where else could the setting be stored?
thanks and peace.

How to enter /data/system/users/0/settings_ssaid.xml without root?

Is there way to enter /data/system/users/0/settings_ssaid.xml without root ?
beacuse this app must need same ssaid in other devices i need to enter /data/system/users/0/settings_ssaid.xml see ssaid without root pls help me
Android ID can be changed with the help of ADB through the following command
Code:
adb shell "settings secure put android_id [my_new_android_id]"
where ROOT isn't required.
xXx yYy said:
Android ID can be changed with the help of ADB through the following command
Code:
adb shell "settings secure put android_id [my_new_android_id]"
where ROOT isn't required.
Click to expand...
Click to collapse
no i want see ssaid first without root after that i will change with other device rooted
OMG
Then simply revise the command as follows
Code:
adb shell "settings get secure android_id"
Hint: Become familiar with Android's system ( LINUX ) commands.
I need app developer help will give you enough money have a problem that I want to solve
This app can be accessed from another device only once a month.
It uses a value called ssaid, which is different for each device.
What I want is to bypass this ssaid value
It seems that this value is stored on the server

Categories

Resources