Hot answers tagged

5

/storage/emulated/0 is usually mounted in a way that prevents execution of programs from this location. Therefore even with a set executable bit for your script you won't be able to execute it directly. Of course you can still execute it via sh: /system/bin/sh /storage/emulated/0/test.sh Alternatively there is the directory /data/local/tmp which is ...


5

Android turns off some of CPUs and/or don't let apps use them when it's dozing. It's achieved through Linux kernel's Control Groups. One of the cgroups is cpuset that controls which CPU is assigned to which processes. Android creates multiple descendant cgroups in cpuset e.g. background, foreground, system-background, top-apps etc. Apps are normally in ...


3

You can setup a Task in Tasker which you can invoke from command-line. The task can be setup with actions of your liking in combination, such as show a notification and vibrate with XYZ pattern. When setting up a task in Tasker, setup the action like this: Alert → Notify Fill up the fields as you like. Make sure to enable Allow External Access setting ...


3

The screencap command can be configured to capture a specific display using the option -d. -d: specify the physical display ID to capture. See dumpsys SurfaceFlinger --display-id for valid display IDs. The output of dumpsys SurfaceFlinger --display-id is a bit longer, therefore you can filter out the display ids: dumpsys SurfaceFlinger --display-id | ...


3

This question is a near duplicate of questions like this and this, and closely related to this and this. In fact it can be better explained by a developer, but since it keeps on appearing again and again with slightly different situations, I'll try to explain what I know with some unnecessary details to make the picture clear from a broader perspective. In ...


2

Write a script in your PC, look for 'reboot' argument, and execute your own command instead. I do not know how a Window's compatible script would look like, but this is how a simple bash script would look like. #!/bin/bash ADB="PATH_TO_RENAMED_ADB_BINARY" if [[ "$1" == "reboot" ]] && [[ -z ${2} ]]; then # $1 is the first argument received by adb ...


2

location_providers_allowed no longer works for Android 10 (API level 29). Instead, you can set the location_mode to LOCATION_MODE_HIGH_ACCURACY with a value of 3: adb shell settings put secure location_mode 3 NOTE: Probably won't work >v29 as this is already deprecated as the docs on Location Mode mention: This constant was deprecated in API level 28. ...


2

This question is nearly a duplicate of this which has a detailed answer by @Firelord, except the Termux part. As mention by @DeathMaskSalesman in comment, Termux is more like a Linux environment, but so far it doesn't have adb and fastboot in repositories, though proposed. Most probably because they are meant for rooted devices. But you can use static ...


2

Note: the solution is tested on a rooted OnePlus 6 running Android 8.1. The command I use is: adb shell su -c 'setprop persist.sys.oem.otg_support true' Some folks on some forums suggested to toggle the value for the global settings key oneplus_otg_auto_disable, but it never worked out for me. My solution survives reboot and OTG would work even when ...


2

Processes receive signals from other processes or kernel as a warning or as a request to make some change in state. Receiving processes can block, ignore or catch signals, except SIGKILL which does what the name says. A process receives SIGHUP (hangup signal) when its controlling terminal (virtual or pseudo) disconnects or its controlling process (which is ...


1

i guess your real purpose of this question is not what the headline suggests - secure erase your data - but instead you want to have a full backup of userdata including /data/media (downvote if i am wrong) you have some options, most require additional binaries which you can copy to /cache partition or permanently integrate into your twrp /sbin e2image ...


1

android.permission.ACCESS_SUPERUSER was defined by SuperSU but: Due to changes in Android 5.0 Lollipop, this permission has been deprecated and is completely ignored from SuperSU v2.30 onwards Also only app which declares a permission in its AndroidManifest.xml file can be granted that permission. Shell (com.android.shell) is an AOSP's dummy app to ...


1

svc wifi enable|disable should work if it's only about turning WiFi ON and OFF. Or you can use setWifiEnabled method directly by calling service wifi. On Android 8.1 its code (order) is 24, so you can do from adb shell: ~$ service call wifi s16 null i32 1 # Trun WiFi ON ~$ service call wifi s16 null i32 0 # Trun WiFi OFF But since you also need to ...


1

I had the same problem and found a solution, fixing the issues that sphakka had in his answer. Create these 2 files: /data/ssh/root/.ssh/environment /data/ssh/shell/.ssh/environment With the following content: LD_LIBRARY_PATH=.:/vendor/lib:/system/lib PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/system/bin:/system/xbin:/system/sbin:/sbin/...


1

I discovered that adb shell detects /data/bin existence and adds it to PATH, the system doesn't seem to do the same at boot though. It's because adb shell starts a shell process (Android's default is MirBSD Korn Shell) which reads its configuration file /etc/mkshrc and can easily change environment variables. But apps inherit their environment from zygote, ...


1

THX to all but the mnetioned solutuions did not work for me. But I found a solution here: https://android.stackexchange.com/a/193667 rm -rf /dev/input/event0 Does "delete" my touchscreen input. The other events disable/delete my other hardware buttons like volume etc. After restart of the phone, they are back. You need root / su for this.


1

Once you have Android Studio set up make sure you can connect to an emulator or a device where it will be listed in the AVD (Android Virtual Devices). If a physical device is connected confirm that debugging mode is enabled and access is allowed to Android Studio. A separate ADB is not needed as all the build tools are part of the IDE. Now you are ready to ...


1

Enable root access for adb from the developer settings menu. Then connect your usb cable and type: adb root It should return restarting adbd as root Now relaunch the shell adb shell


1

If your Android version has svc inbuilt utility, run this command: adb shell svc usb setFunctions rndis This would enable USB tethering. To see what other USB functions are available, run: adb shell svc usb


1

Things were simple before Android 5 when SELinux wasn't enforcing. You could put your code in any script or replace a binary with script which was executed with root privileges on boot. Another method was to define a custom init service specifically to batch execute scripts from some directory. Based on these approaches custom ROM developers introduced ...


1

If you have magisk installed you can place the .sh to: /sbin/.magisk/img/.core/service.d/ or to /sbin/.magisk/img/.core/post-fs-data.d/ Don't forget to make it executable: chmod +x your-script.sh. More info: https://github.com/topjohnwu/Magisk/blob/master/docs/guides.md#boot-scripts


Only top voted, non community-wiki answers of a minimum length are eligible