The next command enables phone call recording in OnePlus phones (may be others too):
adb shell settings put global op_voice_recording_supported_by_mcc 1
But after reboot its effect is disabled. My phone is OnePlus 6T.
How to make this setting persistent?
jOnePlus Tools is an answer. This application sets settings up on every reboot.
https://forum.xda-developers.com/oneplus-5/themes/app-enable-call-recording-boot-t3634292
This link has other root-required methods you might want to try.
Unfortunately, I am also trying to find a way without root. As the setting automatically turns off, sometimes before reboot, when you have an active some-country sim card, my hypothesis is that there is a "checking" program going on under the hood. If there is an adb command to turn off that "checking", the result should be permanent.
I also have a 6T, and what I could see about what causes recording to be disabled, is any application installation made by PlayStore.
If you keep the automatic update function of the applications deactivated, the recording remains activated, but anytime you do any installation on the PlayStore, the recording will be disabled and you will need to enable it with the command again.
Related
With the update to Android 12, a green icon and light appear when using the camera or making a call for security reasons.
Is there a way to turn off the green light when calling or using the camera in Android 12?
please help me
adb shell cmd device_config put privacy camera_mic_icons_enabled false default
LADB Utilities. Only they will help. And only for a day. Then again enter the top two lines in the developer options.
no, there is no option, as you've noticed: its security reason. if any developer could do that (disable this warning) then why Android would introduce such feature... every developer with "not-friendly" intentions would do that in first lines of malicious software...
This feature was introduced for security (privacy) reasons. Rightly so. It should not be 'tampered' with.
However, if there's a need to disable it for a compelling reason, then below is a possibility.
The summary steps are:
install or have ADB (Android Debug Bridge) running on a computer (PC, laptop):
NB: You do not need the full Android SDK or Android Studio. See more on ADB
Enable developer option on the Android phone
Connect the phone to the computer; typically, USB
-- if connecting via WiFi, then enable wireless debugging, pair the phone to the computer and connect. Use appropriate ADB cmd on the computer
-- adb pair ipaddress:portnumber , enter pair key displayed on phone
-- adb connect ipaddress:portnumber
enter the command to disable the green dot.
cmd device_config put privacy camera_mic_icons_enabled false default
if you get an error ... more than one devices connected, then use
cmd -s ipaddress device_config put privacy camera_mic_icons_enabled false default
NB: To enable again,
cmd device_config put privacy camera_mic_icons_enabled true default
For a lasting solution, kindly make use of the above within a Task; one can use Tasker
PS: I'm currently struggling using Tasker successfully for this. I'll update when successful
There's absolutely heaps of these questions out there, all with a seemingly random assembly of answers that don't really talk about why, and don't offer anything that at least covers ALL of the reasonable approaches.
I'm running ADB on OSX, but I've got other team members using Linux (Ubuntu) and I occasionally use Windows. OS doesn't really seem to matter, so long as the relevant USB driver has been installed on Windows.
I've got a heap of different makes and models of phone that I'm swapping in and out. Sometimes a phone that previously worked stops being recognised by adb devices. So not really specific to a particular phone.
I've got a USB cable that I know works, for several makes/models of phone.
But still, when I get a new phone to try I still have to faff around with it to get it working.
What I'm after is a checklist of sorts, that results in a reasonable chance of success in getting adb devices to work.
So here's what I've found:
Hardware:
Good USB cable - if it works for one phone it will probably
work for others. If it consistently stops working, throw it away and
get another.
Phone/Tablet/Device - Pre-requisites:
Make sure the phone is charged up - at least 30% seems to be a common
minimum.
Get all system updates and app updates done.
Enable Developer Mode. Settings->About phone->Build number - tap 7 times
Computer - the 'turn it off and on again' approach:
This is useful to know, but doesn't generally get things working. It goes like this:
adb kill-server
adb start-server
adb devices
If you don't see your device after adb devices then the above isn't the answer (but it's still good to know).
Phone/Tablet/Device - the 'wipe it and start again' approach:
This is basically clear your current settings and then re-establish them.
In Developer options, under Debugging:
Turn OFF USB debugging (some phones won't let you click this option - thanks LG)
Click/Tap Revoke USB debugging authorizations
Turn ON USB debugging, answer OK to the first dialog
And if you device is already plugged in:
WAIT, for a second prompt asking if you want 'Allow USB debugging' and click 'OK' - not every device will trigger this second prompt straight away, but give it 5 to 10 seconds just in case.
Now, get permission for EVERY use of the USB connection.
Swipe down from the top and tap on the item for USB connection.
Systematically work through every option your device provides and grant permission when asked. Don't do just one option, do ALL of them, including Charge phone.
Having given permission for one of the usages of the USB connection some devices will give permission for everything - but most won't. For the majority you should go through each one and give the permission. Just to add to the confusion some devices will require you to revisit an option a second time before they give you the prompt asking for permission (thanks again LG).
Now try adb devices again. Still nothing? Go back through the USB usage options again from start to finish (I kid you not).
You may still need to reboot the device and/or swap between media transfer and photo transfer to get it showing up on adb devices.
So what if a previously working device stops working? Go through the 'wipe it and start again' approach first. It's likely to be the most effective. but I'd definitely check whether its time to retire the USB cable as well.
Most of my development devices have OLED displays, so they can't safely have "Stay Awake" enabled under "Developer Options" (I've ruined WAY too many devices using it in the past). But having to continuously keep picking up the device to hit the power button every time I re-launch something within Android Studio is driving me insane.
Is there any way to configure the devices and/or Android Studio to allow the screen to time out and turn off as usual, but automatically turn it back on again whenever I do something via ADB?
For what it's worth, I tried disabling lockscreen security, but launching a program or debugging session via shift-f9 or shift-f10 while the screen of the ADB-connected device is off still fails to turn it on.
Before starting the app, run
adb shell input keyevent KEYCODE_POWER
to wake up the device
write this code in Oncreate and before Setcontentview :
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
screen will never sleep with this code.
I need to run a security test on one of our Android mobile applications.
It must not run if the device is rooted.
It should run as expected on non-rooted devices.
I have tested part 1 without issue and found it to work as expected.
However, I cannot seem to create an emulator using the AVD Manager that will not start with root access.
-Is there a command line method to reduce the emulator instance to non-rooted at startup?
-Failing that, is there a method to send an adb shell command (or other command line call) to reduce the permissions to the installed application?
Thanks!
Edit for #Fred.
I have opened the shell and changed it to the user id (uid) of the application under test. Note that in the image you can see the command, "adb shell su u0_a53" and then the next prompt includes the user, "u0_a53#generic_x86_64" as the returned shell and has the "$" indicating non-root access. However, when opening the application under test on the emulator, the application detects the device is rooted. What am I missing?
See attached image - click here
Yes, there is a way using SU to change super user to non root, see answer in this so question for directions:
https://android.stackexchange.com/questions/60599/how-to-get-non-root-access-on-emulators
As it turns out, my question was fundamentally flawed. The environment i'm trying to achieve could not be created with an emulator as part of the security test checks to see if the phone is in 'release' mode, in addition to looking for the presence of 'su'. After conferring with several other teams, I have decided to obtain a physical phone for testing this security restriction.
I've tried to do as much research as possible but can't find an answer to this fairly simple question (want to figure this out before I'm going to set up the SDK and everything).I'm thinking about developing my first app and am wondering whether the BATTERY_STATUS_CHARGING from the BatteryManager contains only a get function or also a set function.
I wan't to make an app in which I can manually stop the phone from charging without unplugging it from the charger (via USB) and so am wondering whether this is actually possible.
No, Its not possible on unrooted devices. It uses Settings.System with ADB_ENABLED, but ADB_ENABLED is a Secure-System-Setting which can not be changed by a application.
Yes, It can be done on rooted phone.
There is need to add an permission android.permission.WRITE_SECURE_SETTINGS.
Same type of application on Google Play : https://play.google.com/store/apps/details?id=com.jim2&hl=en
You can hardwire it: 12 ohms in serial still makes the phone be recognized by the computer, yet slowly discharge. See attached Picture.
I know this thread is old but posting my ans anyways for someone reaching here later.. Try this:-
echo 0 > /sys/class/power_supply/batterycharging_enabled/charging_enabled
This is unfortunately not possible. Android only have read APIs for battery data. ADB_ENABLED will not help in this instance either as it's only to enable debugging over USB.
Battery charging control is internal to the Android kernel and battery IC modules. Manufacturers do change it from time to time, but it's not available to apps without root and without controlling the IC (integrated chip) modules through some tricky interface which would actually be different for almost every device out there!
At best if we're lucky, a sysfs interface might help do that, but again it requires root and may differ from device to device.
Use the below command to stop the charging of mobile/handheld when connected to USB:
adb shell dumpsys battery set ac 0; dumpsys battery set usb 0;
Use the below command to stop charging on Android 11.
device need to be rooted.
I'm using Termux but Linux Deploy can be also be used.
sudo nano /sys/class/power_supply/battery/charger.0/stop_charge
Change value to 1 to stop and 0 to start again