How do I set the Device Owner? (adb) - To disable system apps - OPPO Find X2 Pro Questions & Answers

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?

Related

Failed to diable the captive portal detection

Hey guys,
I was having trouble when disable the captive portal detection.
I got a Nexus5 with the latest original 6.0 rom MRA58N. To root the device, I also flashed a third part kernel, which is ElementalX 6.05 and SuperSU 2.46.
I used the adb shell on my computer and got a error prompt as shown below:
settings put global captive_portal_detection_enabled 0
Error while accessing settings provider
java.lang.NullPointerException: Attempt to invoke interface method 'android.app.
IActivityManager$ContentProviderHolder android.app.IActivityManager.getContentPr
oviderExternal(java.lang.String, int, android.os.IBinder)' on a null object refe
rence
at com.android.commands.settings.SettingsCmd.run(SettingsCmd.java:141)
at com.android.commands.settings.SettingsCmd.main(SettingsCmd.java:63)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)
Anyone here can help me?

Can't disable apps with adb

I'm writing a script in windows (batch) that stops, clears, uninstalls updates and disables bloatware..
When I use "adb shell pm disable <packageName>", it causes an error:
Error: java.lang.SecurityException: Permission Denial: attempt to change component state from pid=19900, uid=2000, package uid=10048
I know that using "su" makes the above command work, but this script is intended to work on non-rooted devices.. Is there any way to make this work?
---
If not, I have another idea: launch app info (in "settings" app) and navigate to the "disable" button using adb by emulating key presses.. It would manually+programatically disable apps..
Disadvantage is that I don't know any command to do that

Device Owner already set

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.

[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:

Lineage OS 17.1: running app as root username

I would like an application to run as root in order to make privileged system calls for performance analysis. To that end, I've installed Lineage OS 17.1, and have /system partition writable and have downloaded Magisk manager systemizer. However even after moving the application to /system/app/ and launching the activity via
Device: OnePlus 6T
> am start -n package_name/package_name.ActivityName
the application still launches as a regular user, i.e. username u0_* thereby still not allowing privileged system calls from being made, e.g. perf event calls here:
perf_event_open(2) - Linux manual page
Can someone please help or point me to whether any other custom ROM could help with this.
Thanks!
IMO this thread's title is misleading: user with UID 0 is the root user, means Android's default user, means the user for whom device was registered.
If your intention is to have an app superuser rights may be this helps: add
Code:
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
to app's Manifest file.

Categories

Resources