Unable to grant permissions using adb - BetterBatteryStats

xiaomi mi max 2
I get an error:
adb -d shell pm grant com.asksven.betterbatterystats android.permission.BATTERY_STATS
Operation not allowed: java.lang.SecurityException: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.

Turn on the USB debugging (Security settings)

Permissions not allowed
I'm not able to get permission either
./adb -d shell pm grant com.asksven.betterbatterystats android.permission.BATTERY_STATS
Operation not allowed: java.lang.SecurityException: Permission android.permission.BATTERY_STATS is not a changeable permission type

Poley59 said:
Turn on the USB debugging (Security settings)
Click to expand...
Click to collapse
The option is enabled and still nothing!

MadK9 said:
The option is enabled and still nothing!
Click to expand...
Click to collapse
You have to turn all 3 usb debugging options on for miui.

thanks man
cpthero said:
You have to turn all 3 usb debugging options on for miui.
Click to expand...
Click to collapse
thanks dear it did worked for my Redmi Note 8 Pro :laugh:

cpthero said:
You have to turn all 3 usb debugging options on for miui.
Click to expand...
Click to collapse
Where you do that? Im on miui 11 android 9 (redmi note 8 pro)

danielofata said:
Where you do that? Im on miui 11 android 9 (redmi note 8 pro)
Click to expand...
Click to collapse
In the developers menu, you will find usb debugging and a bit more down the other one. I had to select both to get it working (mi 9t pro on miui 11 android 10)

Dxue said:
In the developers menu, you will find usb debugging and a bit more down the other one. I had to select both to get it working (mi 9t pro on miui 11 android 10)
Click to expand...
Click to collapse
Hi,
i am struggling with this right now. I got a Note 8 Pro with MIUI Global 11.0.3. I am trying to get BetterBatteryStats to show me what wakes up my phone. When using ADB i get the same error message ticatc3 got.
What exact setting do i need to activate? Most of them want me to "sign in to my Mi Account first" (what the heck for?).
If i knew how to attach a screenshot i would do so.
The Settings i got are:
USB debugging
Install via USB
USB Debugging (Security Settings)
Select debug app
Greetings

Realme X2 Pro - Color OS6 - USB debugging
Hey,
I just had the same problem with my Realme X2 Pro. USB debugging was not enough. It worked after I activated the bottom most option in the developer options:
"Disable Permission Monitoring" (English) / "Erlaubnisüberwachung deaktivieren" (German)
Just for completeness.

dadri said:
Hey,
I just had the same problem with my Realme X2 Pro. USB debugging was not enough. It worked after I activated the bottom most option in the developer options:
"Disable Permission Monitoring" (English) / "Erlaubnisüberwachung deaktivieren" (German)
Just for completeness.
Click to expand...
Click to collapse
thanks !
I was exactly looking for this

tschesny said:
Hi,
i am struggling with this right now. I got a Note 8 Pro with MIUI Global 11.0.3. I am trying to get BetterBatteryStats to show me what wakes up my phone. When using ADB i get the same error message ticatc3 got.
What exact setting do i need to activate? Most of them want me to "sign in to my Mi Account first" (what the heck for?).
If i knew how to attach a screenshot i would do so.
The Settings i got are:
USB debugging
Install via USB
USB Debugging (Security Settings)
Select debug app
Greetings
Click to expand...
Click to collapse
You have to enable all of them so that you can grant permissions

thanks a lot dadri, I was having the exact same problem on my x2 pro with realme ui and with yoyur input I finally got betterbatterystats working has it should

dadri said:
Hey,
I just had the same problem with my Realme X2 Pro. USB debugging was not enough. It worked after I activated the bottom most option in the developer options:
"Disable Permission Monitoring" (English) / "Erlaubnisüberwachung deaktivieren" (German)
Just for completeness.
Click to expand...
Click to collapse
Thanks, it worked on my realme 1

For COLOR OS you have to disable permission monitoring, is at the botton of developer options. USB Debugging and disable permissions, you have to select both options.

Not sure if this is the same issue or not but I am trying to run an adb command for the first time, the command is this
adb shell pm grant com.maxmpz.equalizer
android.permission.dump
These commands are listed under two different lines. When I try to run them separately I get an error saying no permissions specified. When I run them under one line I get an error that says,
Exception occurred while executing:
java.lang.IllegalArgumentException: Unknown permission: android.permission.dump
on my LG G7 the developer options are a bit different, under USB debugging, this is what i see..
https://imgur.com/JbEFacE
What should I do to get this to work?

cpthero said:
You have to turn all 3 usb debugging options on for miui.
Click to expand...
Click to collapse
This worked for POCO X3 Pro. Thank you very much.

swagmuel said:
For COLOR OS you have to disable permission monitoring, is at the botton of developer options. USB Debugging and disable permissions, you have to select both options.
Click to expand...
Click to collapse
you are a savior!!!!
thank you!!!

I'm having this problem on my LG V20 with Oreo. It let me enable 2 of 3 permissions, but not PACKAGE.USAGE.STATS.
The error:
Operation not allowed: java.lang.SecurityException: Package com.asksven.betterbatterystats_xdaedition has not requested permission android.permission.PACKAGE_USAGE_STATS

dadri said:
Realme X2 Pro - Color OS6 - USB debugging
Hey,
I just had the same problem with my Realme X2 Pro. USB debugging was not enough. It worked after I activated the bottom most option in the developer options:
"Disable Permission Monitoring" (English) / "Erlaubnisüberwachung deaktivieren" (German)
Just for completeness.
Click to expand...
Click to collapse
THANK YOU!!!!! Man i thought i was screwed as a use taser a lot and needs a LOT of ADB functions like monitoring Clipboard. this should be the 1st google search entry when searching for this problem. I literally made an account just to post this .

Related

[SOLVED] problem WiFi hotspot

Finally found the solution with my z3c. Problem started with Lollipop. When I was using my phone as portable AP there was no Internet access on any device connected. There were many descriptions of solutions (manual settings, soft reset, deleting all APNs) but none of them worked for me.
My service provider suggested changing APN settings:
Use whatever APN you find working for you, and change "APN type" field from "default,supl" to "default,dun".
Now everything works just like it's supposed to.
Sorry if someone posted this already or if it's under wrong subject. This is my first thread. Thanks.
I use this solution and it works for me:
http://forum.xda-developers.com/z3/general/lollipop-tethering-t3058923
------------------------------------------------------------
This can be fixed permanently using the following procedure (UPDATE: no root required):
Enable developer mode (Go to Settings -> About phone, and click on the build number until the developer mode is enabled).
Enable USB debugging under Settings -> Developer options
Connect the device with a USB cable to a computer with the Android SDK platform tools installed (any modern adb.exe works, the one included with FlashTool, for example)
Start an adb shell: adb shell
In the adb shell, run this command: settings put global tether_dun_required 0
------------------------------------------------------------
BarajaVLC said:
I use this solution and it works for me:
http://forum.xda-developers.com/z3/general/lollipop-tethering-t3058923
------------------------------------------------------------
This can be fixed permanently using the following procedure (UPDATE: no root required):
Enable developer mode (Go to Settings -> About phone, and click on the build number until the developer mode is enabled).
Enable USB debugging under Settings -> Developer options
Connect the device with a USB cable to a computer with the Android SDK platform tools installed (any modern adb.exe works, the one included with FlashTool, for example)
Start an adb shell: adb shell
In the adb shell, run this command: settings put global tether_dun_required 0
------------------------------------------------------------
Click to expand...
Click to collapse
My post is about portable hot spot, not USB tethering. I'm not sure if your post is about the same thing
If yes, then I'm very glad that we have multiple solutions for the same problem
Whoa! My girlfriend had this same problem on a moto g 2014 she bought a year ago, so yesterday I changed her APN type as you said and now everything's working. Thanks a lot.
Sent from my D5833 using Tapatalk
dgaspa75 said:
My post is about portable hot spot, not USB tethering. I'm not sure if your post is about the same thing
If yes, then I'm very glad that we have multiple solutions for the same problem
Click to expand...
Click to collapse
Yes, the solution I provided makes portable WiFi hotspot work
APN Type change to "default,dun" worked like a charm for me.
'settings' is not recognized
i have same problem hotspot is not working i installed android studio 3.0.1 and ran command
settings put global tether_dun_required 0
i get error
C:\Users\log\AndroidStudioProjects\MyApplication>settings put global tether_dun_required 0
'settings' is not recognized as an internal or external command,
operable program or batch file.
any help please
APN Type change to "default,dun" worked like a charm for me...thanks brother
Thanks so much for this! Genius!!

Changing the DPI/"display size" on the stock global rom without root

tldr; the stock global MIUI rom lacks a display size setting, but an awesome free option by zacharee1 lets you set it anyway, even without root, and with no need to reboot or anything:
https://labs.xda-developers.com/store/app/com.zacharee1.dpichanger
----
I love the Max 2 -- way more than I thought I would! I bought it as a replacement for my old, sadly dead Nexus 7 tablet, but if it had LTE bands for US T-Mobile, this might have been my next phone. But for all that, MIUI made some "customization" decisions to android that I just don't understand... like two finger drag for expanding a notification... and removing the "Display Size" setting.
On other Android N roms, you can easily adjust the zoom/DPI/display size, making things smaller or larger. The stock global MIUI version on the Max 2, however, is missing the setting (and the "Smallest width" setting in developer options.) I thought I was out of luck after trying an option from the play store that failed, but found an app in XDA Labs from zacharee1 that worked!
It did require enabling adb, and developer options; in addition steps, I had to go to developer options and enable "USB debugging (security settings)" with a sim card inserted. Normally I used the Max 2 without one, but if you don't have a sim card inserted it will tell you to insert one, then fail.
Anyway, if anyone else would like to fit a bit more content on the screen, I'm really happy with this app so far! Some of Xiaomi's own apps don't quite scale well, which is probably why they disabled it, but they just have extra padding around the content. They still work just fine.
Awesome!
Sorry, noob here. When I run the command it tells me "error : no devices/emulators found"
I have turned on both USB debugging options in developer options and am using Minimal ADB and Fastboot. No Root.
Any help would be greatly appreciated!
Worked well!
Just chiming in and letting you guys know that the app package is zacharee1 (one), not zachareel (L). Gave me some problems for a bit!
user4001 said:
I have turned on both USB debugging options in developer options and am using Minimal ADB and Fastboot. No Root.
Any help would be greatly appreciated!
Click to expand...
Click to collapse
Oh, sorry. I've never used minimal adb before -- have you tried running the adb command as an administrator? (You might have to run "adb kill-server" first, it will used an existing adb server with fewer privileges if it exists.)
whd5015 said:
Worked well!
Just chiming in and letting you guys know that the app package is zacharee1 (one), not zachareel (L). Gave me some problems for a bit!
Click to expand...
Click to collapse
Nice! That's a good tip, too, thanks. (I've wasted hours before figuring out a capital O wasn't a 0 before...)
ldrn said:
Oh, sorry. I've never used minimal adb before -- have you tried running the adb command as an administrator? (You might have to run "adb kill-server" first, it will used an existing adb server with fewer privileges if it exists.)
Nice! That's a good tip, too, thanks. (I've wasted hours before figuring out a capital O wasn't a 0 before...)
Click to expand...
Click to collapse
I'll try the administrator thing, thanks. I have no idea what
what ADB kill server is but will Google when I get home.
I tried it without root. I using adb in administrator mode, but it gives me an error:
C:\adb>adb shell pm grant com.zacharee1.dpichanger android.permission.WRITE_SECURE_SETTINGS
Operation not allowed: java.lang.SecurityException: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
Any suggestions?
ruairi said:
Operation not allowed: java.lang.SecurityException: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
Click to expand...
Click to collapse
Actually, yep! In developer options, there is a "USB debugging" toggle, then three lines down a "USB Debugging (Security settings)" toggle, that's the error you get when you have the first one toggled but not the second. You need both turned on.
(I'm speaking from personal experience, I made that same mistake at first; it's a bit confusing that the names are almost the same!)
thanks @ldrn, I'll give it a shot.
Works like Charm. I have set the DPI to 410 Thanks!
adb shell wm density XXX
i use "adb shell wm density 420"
display will refresh every time i change dpi. no sestart require
Is this safe for MIUI rom?
w4h1d said:
Is this safe for MIUI rom?
Click to expand...
Click to collapse
Yes it is safe tested in MIUI Global 8.5 | Stable
make sure USB debugging (Security settings) is enabled in developer options
The link is dead. Where can I download the app?
inunt said:
i use "adb shell wm density 420"
display will refresh every time i change dpi. no sestart require
Click to expand...
Click to collapse
So do I have to write this command on my computer? No app needed? If app from first post is needed, where can i find it?
Link is not working. Please new link? Thank you.
Link dont work
Can some one tell me what is the stock value of DPI
reversegear said:
Can some one tell me what is the stock value of DPI
Click to expand...
Click to collapse
stock value of dpi is 440
Link does not exist
The link to above app says that the file does not exist on the server. Can anyone please give me the valid link for it?

GSam battery monitor/BBS on MIUI devices

Hello guys.
I can't get the two apps in the title to work. GSam doesn't even load once opened (all set to 0:00:00 and on "loading"), and both of them reject the command from adb for advanced stats, telling me "operation not allowed [...] neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS."
Do you know what's going on?
Answer on your question. Give all permissions to bbs from security app.
xdamami said:
Answer on your question. Give all permissions to bbs from security app.
Click to expand...
Click to collapse
Still no luck, I went to security app, manage application, BBS and activated all it needs, so permissions to phone, storage, start in background, lockscreen and home screen.
What am I still missing? From my PC I can't use the adb command..
Up
Anyone?
"operation not allowed [...] neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS."
Be sure you enabled TWO settings in Developer Options :
USB Debugging
USB Debugging (Security Settings)
Good luck!
virgil31 said:
"operation not allowed [...] neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS."
Be sure you enabled TWO settings in Developer Options :
USB Debugging
USB Debugging (Security Settings)
Good luck!
Click to expand...
Click to collapse
Thanks, found that two days ago! Now it's fine
virgil31 said:
"operation not allowed [...] neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS."
Be sure you enabled TWO settings in Developer Options :
USB Debugging
USB Debugging (Security Settings)
Good luck!
Click to expand...
Click to collapse
Thanks man. It was giving me issues on Android Pie

Edit toggles disappeared on 9t Pro MIUI 11.0.3.0

Hi everybody,
I just updated my Mi 9T PRO to 11.0.3.0 as suggested by the notification. The problem is that scrolling down the top bar I can't see the edit button to edit the toggles no more. I don't even have the second page of toggle. For example I'd like to add the button to switch gps and wifi tethering on and off.
Another maybe related problem is that I can't see any option to enable the app drawer that should have finally be released.
I yet tried to factory reset and then reinstall the miui 11.0.3.0 from setting menu, but nothing changed.
Have you got any solution pls?
Thanks
gorale said:
Hi everybody,
I just updated my Mi 9T PRO to 11.0.3.0 as suggested by the notification. The problem is that scrolling down the top bar I can't see the edit button to edit the toggles no more. I don't even have the second page of toggle. For example I'd like to add the button to switch gps and wifi tethering on and off.
Another maybe related problem is that I can't see any option to enable the app drawer that should have finally be released.
I yet tried to factory reset and then reinstall the miui 11.0.3.0 from setting menu, but nothing changed.
Have you got any solution pls?
Thanks
Click to expand...
Click to collapse
Same problema with Redmi Note 5 with latest weekly miui.eu cleaned installed
Hi, Solution? I Have mi 9 and same problem...
Hello dear,
If you have been facing this problem since the MIUI update, you can try a factory reset once. If the problem is not resolved after a factory reset, follow this process.
This method uses ADB and you require a PC or a laptop for this process.
(1) Download Android SDK Platform Tools to your PC/laptop and extract the zip file to C drive. If you are using Windows 7, you may need to download and install Xiaomi USB drivers if not already installed.
(2) Go to Settings- Additional Settings- Developer Options- enable USB Debugging & USB Debugging (Security Settings).
(3) Connect your mobile to PC / Laptop using original USB cable.
(4) Run CMD as administrator and type "cd C:\platform-tools" and press enter.
(5) Type "adb devices" and press enter - It will display a list of your devices connected to the PC / Laptop.
(6) Type "adb shell settings put secure sysui_qs_tiles default" and press enter - This will reset your notification shade. Now you will find the edit toggle.
Hopefully your issue will be solve by this process. Thanks

How to rescue data from my 9T Pro

So while walking it slipped out from my hand and hit the lower left corner.. The screen didnt even work anymore (after removing the glas, it was clear why, as the connector is lower left corner).
Good thing is, I have adb debugging enabled and my keys are known.. So I can access adb shell and various commands..
My problem is: It rebooted and now, the important stuff is NOT mounted.. Also via scrcpy or MonkeyRemote, I cannot send any touch event... Its not reacting at all.. Honestly, I dont know what it is doing, but its quite busy writing for ever logs in logcat, that the sensors have errors (which is no wonder).
So I tried various "adb shell input XXX", but its not working at all..
Tried to connect a mouse via normal usb-c hub, but I dont know if I would need an OTG cable or if it would even work.
DrFone and some other software, already wants the money, before unlocking anything.. And I would be Ok, if it would be 5-10€.. But buying the whole thing for 1 test, is a big no.
So my status:
adb shell working.
scrcpy at least showing a screen
phone is not reacting on anything else, besides the lockscreen to wake it up.. volume keys are also kinda ignored.
I tried the adb shell input stuff from stackoverflow, but nope.
Can I boot in any recovery thing and mount sdcard there? Does scrcpy work there?
What he heck is my phone even doing?? If I connect another phone in lockscreen and use scrcpy, I can also wake it up normaly.. So probably not only the screen got dmg while flying :/
Most annoying things: It has alarms going off all the time, as I can only snooze them -.-
Is there no command, to unlock it from adb/terminal? I know the damn pin
When I run top, the top most things are sufaceflinger and logd (between 2-15). So its not like sth is always at 100% cpu load..
So little status update:
all adb shell input XXX are simple not working, as Xiaomi needs another setting for that.. Which I cannot activate, without screen.
I will try a manual keyboard at home..
Is there a way, to root it with adb only? Would help me alot..
MIUI security center requires you bonded MI account to enable adb input commands in developer options. scrcpy has OTG mode and can emulate HID device.
scrcpy also didnt work, without that stupid setting set to be true/1.
Tested with my old Mi6. When I enabled the option in dev-settings, it worked fine.
But I was able to unlock it with a keyboard plugged in (+ mouse). Looks like the CPU also has some issues, as everything is slow-motion..
So I just tried, what do I need to press on the Mi6 -> then did it on the Mi9.
"hitting space -> pin -> enter", "hitting space -> pin -> enter".
But was able to rescue all my data + turn off the alarms.
PS.: I then tried to enable this setting, for inputs, but you need to have a SIM cart inserted, to activate it
PPS.: Oh.. Now I got you.. I have to enable this option in scrcpy.. OMG Will test that now
PPPS.: Yeah, with that otg mode, the keyboard and mouse would have also worked.. Well, for the next time I know it
alecxs said:
MIUI security center requires you bonded MI account to enable adb input commands in developer options. scrcpy has OTG mode and can emulate HID device.
Click to expand...
Click to collapse
Ok, thanks - that was missing
If you figure out the command line to enable it from adb settings put global I am very grateful
alecxs said:
If you figure out the command line to enable it from adb settings put global I am very grateful
Click to expand...
Click to collapse
Ok, so I dumped all settings and props to files:
Code:
adb shell settings list global > global.txt
adb shell settings list secure > secure.txt
adb shell settings list system > system.txt
adb shell getprop > props.txt
then searched for adb, usb and similar butfound only the following:
SETTINGS GLOBAL:
adb_enabled=1
adb_wifi_enabled=0
verifier_verify_adb_installs=1
GETPROP:
persist.security.adbinput=1
persist.security.adbinstall=1
(My phone: Mi 11 Lite 5G NE, MIUI 13)
That is, eg ADB can be enabled/disabled as settings global adb_enabled
However, ADB Input is not in settings but as persistent prop persist.security.adbinput and it can be only manipulated by Magisk - and by TWRP but on the old devices where System is not read-only
IMO, it would be theoretically possible on the Mi 9T Pro, but not if display is broken where TWRP cannot be used (I doubt there is anything like scrpy that works for TWRP)
zgfg said:
Ok, so I dumped all settings and props to files:
Code:
adb shell settings list global > global.txt
adb shell settings list secure > secure.txt
adb shell settings list system > system.txt
adb shell getprop > props.txt
then searched for adb, usb and similar butfound only the following:
SETTINGS GLOBAL:
adb_enabled=1
adb_wifi_enabled=0
verifier_verify_adb_installs=1
GETPROP:
persist.security.adbinput=1
persist.security.adbinstall=1
(My phone: Mi 11 Lite 5G NE, MIUI 13)
That is, eg ADB can be enabled/disabled as settings global adb_enabled
However, ADB Input is not in settings but as persistent prop persist.security.adbinput and it can be only manipulated by Magisk - and by TWRP but on the old devices where System is not read-only
IMO, it would be theoretically possible on the Mi 9T Pro, but not if display is broken where TWRP cannot be used (I doubt there is anything like scrpy that works for TWRP)
Click to expand...
Click to collapse
Btw (sorry, OT for the originally reported problem), Netflix cannot be fooled (DRM) to display over scrcpy, only subtitles are displayed on the PC
YT works fine (although without sound - I will try with sndcpy), and strcpy properly recognizes landscape orientation, hence window on the PC can be stretched over the whole monitor
Edit: On the other PC I tried, audio works fine with scrcpy
zgfg said:
However, ADB Input is not in settings but as persistent prop persist.security.adbinput and it can be only manipulated by Magisk - and by TWRP but on the old devices where System is not read-only
Click to expand...
Click to collapse
Nice! I was curious because I don't have Mi account. Although I didn't have this property, just set it from resetprop anyway and it worked!
We can set it from magisk patched boot.img ramdisk/overlay.d/custom.rc systemless. or just add it in init.rc directly.
Code:
on boot
setprop persist.security.adbinput 1

Categories

Resources