Run Shell for Carrier Label - Tasker Tips & Tricks

I'm running Dirty Unicorns ROM. It has an option for custom carrier label. When I run shell for "settings list system" the line custom_carrier_label=Verizon Wireless shows. I want to hide all notifications from the lock screen and have my carrier label show %SMS (variable for unread SMS) Message if %SMS>0. My code settings put system custom_carrier_label=%SMS Message in run shell doesn't work. If this is possible what am I doing wrong?
Sent from my Nexus 6P using Tapatalk

You probably need to restart systemui for the change to take effect.
To do that, run this shell command as root:
Code:
pkill -l TERM -f com.android.systemui
If your screen is on when this command runs, whatever you are doing well get interrupted by your lock screen.
To avoid being interrupted, add this action before the shell command:
Code:
Wait Until
%SCREEN ~ off
Also, your 'settings put ...' shell command needs to be run as root.

Depending on your ROM broadcasting
Code:
android.intent.action.CUSTOM_CARRIER_LABEL
might also work.

Related

adb shell and arrow keys

is it just me, or when you "adb shell" into the device and then use a program that uses the arrow keys everything goes berserk?
it seems like it's overlaying the command history into the on-screen buffer and all future interactions are corrupted beyond repair.
for example, run vi and use arrow keys to navigate around (yes, i know there are other methods for this, just using this to illustrate) and it pulls info from some sort of history buffer on to the screen.
another example is the ash shell. up and down arrows behave nicely at first allowing you to scroll through your command history. but, it degrades fairly rapidly into being unusable
this does not seem to be an issue using scroll ball in terminal on the device.
I can't find anything in the Android Issues Page.
I've reproduced this in multiple builds on multiple OS's on multiple machines (but I've only got one G1, hence this thread)
Does anyone have any insight?
What OS? Mine behaves this way too, and I think the root problem is the Windows command prompt. Read a comment somewhere on here that makes sense - something along the lines of cmd.exe not properly interpretting ANSI control codes? Need to hit up Google, maybe there's an alternative command shell that would solve this for Windows users.
EDIT: Ok, really need to work on reading comprehension - you tried multiple OSes? I was all set to blame MS. Anyway, I tested in Cygwin, Command2, Command2 wrapped around bash.exe .. No luck. Problem has to be in ADB itself somewhere, either the daemon on the phone or in all the clients.
Saiboogu said:
What OS? Mine behaves this way too, and I think the root problem is the Windows command prompt. Read a comment somewhere on here that makes sense - something along the lines of cmd.exe not properly interpretting ANSI control codes? Need to hit up Google, maybe there's an alternative command shell that would solve this for Windows users.
Click to expand...
Click to collapse
Thx for the reply.
I use a Mac mostly, but have similar response in Linux and Windows.
I've tried Terminal.app as well as iTerm on the Mac.
I tried cmd.exe, powershell, & cygwin / bash in Windows.
I agree it almost has to do have something to do with the way the adb daemon handles ANSI codes.
Maybe this will help...
Hi All,
I don't reckon there isn't an actual problem.
The "DOS" console is not a terminal program and thus doesn't behave proper, and the DOS telnet program is just as bad!
In linux, the console is a terminal program, but is also very generic.
The adb shell is not a very good telnet server either in terms of terminal handling; which all really boils down to the sh being to limited as a login shell.
The following may help a little.
Have PuTTY or the like handy.
For windows, copy paste the following or something like it into a bat file (dlink.bat I called it):
The important bit is the forwarding...
Code:
@echo off
:init
::REM //-----------------------------------------------------------------------
set prog=%~f0&&REM This
set progDir=%~dp0&&REM This location
set workdir=%cd%&&REM Current locataion
set ADB=%progDir%adb
echo --Droid Link--
echo current settings:
echo -----------------
echo prog=%prog%
echo progDir=%progDir%
echo workdir=%workdir%
echo -----------------
::REM //-----------------------------------------------------------------------
::REM //ensure a clean house
%ADB% kill-server&&echo adb server clean: Ok.||echo adb server clean: Problem...
::REM //start fresh server instance, use its own shell as it will not detach from the shell until it ends elsewise due to it running in daemon mode
%SystemRoot%\system32\cmd.exe /e:on/v:on/f:on /c "%ADB% root>nul:"
::REM //get id of the Android (will need to be adjusted for more than one)
for /f %%a in ('"%ADB% devices|find "HT""') do set adev=%%a
::REM //see if we found our device
if .%adev%.==.. (
echo Android not detected...
goto :done
) else (
echo Android detected as:%adev%
)
::REM /if
set DROID=%ADB% -s %adev%
::REM //-----------------------------------------------------------------------
:begin
::REM //-----------------------------------------------------------------------
::REM //forward telnet port
%DROID% forward tcp:18023 tcp:23
::REM //forward ssh port
%DROID% forward tcp:18022 tcp:22
echo This terminal is now held by --Droid Link--
echo You can now connect to Android:%adev% via telnet host:127.0.0.1 port:18023
echo And if you start a ssh server...
echo You can connect to Android:%adev% via ssh host:127.0.0.1 port:18022
echo For best results, use a program like PuTTY or something (dos telnet is lacking).
%DROID% shell telnetd
echo --Droid Link: Closed---
::REM //-----------------------------------------------------------------------
:done
::REM //-----------------------------------------------------------------------
%ADB% kill-server&&echo adb server off-line.||echo adb server dropped: off-line.
::REM //cleanup
set DROID=
set ADB=
set adev=
::REM //-----------------------------------------------------------------------
:xit
echo End of line.
::REM //-----------------------------------------------------------------------
For Mac, I'm afraid I rely on my linux syntax and pray it works the same in OSX:
adb -s {device ID} forward tcp:18023 tcp:23
note the adb -d forward tcp:18023 tcp:23 may do the trick also.
I use PuTTY and have a profile called Android-Telnet, which can be called from the console as putty.exe -load Android-Telnet
PuTTY may or may not be the end-all, be-all of terminal programs, but I like it, it works, and is multiplatform.
Hope that helps.
tyvm, Darkstrumn. that worked great! Can't believe i didn't think to try this as a workaround.
all i did (on OSX Leopard):
adb shell telnetd &
adb forward tcp:9999 tcp:23
telnet localhost 9999
now, to get working on compiling dropbear 0.52 and / or patching adb *eek*
i guess a related question becomes, is there any way to change ash to the default login shell?
alapapa said:
tyvm, Darkstrumn. that worked great! Can't believe i didn't think to try this as a workaround.
all i did (on OSX Leopard):
adb shell telnetd &
adb forward tcp:9999 tcp:23
telnet localhost 9999
now, to get working on compiling dropbear 0.52 and / or patching adb *eek*
i guess a related question becomes, is there any way to change ash to the default login shell?
Click to expand...
Click to collapse
Just a note: The windows version of this is just as simple as those 3 commands, the complexity of the script is simply allowing the script to lock-on to the device by id; my actual scripts enumerate the devices including the emulator into the %adevN% variables where N is 0-X. %adev0% will always be the first instance of the emulator found and %adev1% will always be the first instance of a true device found. I simple made it light and posted it. I think it only matters if you are using the emulator and have a live device connected and what to work with both.
Let me know if the enumeration script would be handy and I can post it also.
I haven't gone the route of dropbear just yet, but I'm interested in using ssh vs telnet.
As far as ash goes, I reckon the trick is to setup a chroot to use it as the console...maybe override the console service defined in init.rc.
Note I think ash is expecting the passwd file to exist and have meaning, so that may need to be setup to have ash behave a little better in the Android environment.
Thanks! This worked a treat for me.
I was having trouble with lynx and ansi chars within an adb session, the forward made my day .
Actually I got rid of the complex batch above, I just set up two small batch files:
myadbshell1.bat
@echo 1
@adb forward tcp:18022 tcp:22
@adb forward tcp:18023 tcp:23
@adb shell telnetd
@exit
myadbshell2.bat
@echo 2
@putty.exe telnet://127.0.0.1:18023
@exit
Run the first, then the second.
Do your story in putty, when exit everything will close.
Why echo 1 and 2? Because withouy I was getting the two batchs hanging, dunno why. :-?
Everything on windows environment.
In windows I created a .bat file called adb.bat, where c:/adb/ is where I installed the SDK:
Code:
c:/adb/tools/adb remount
c:/adb/tools/adb forward tcp:9999 tcp:23
c:/adb/tools/adb shell telnetd
I run this file as Administrator, and then I can telnet into localhost:9999 with putty. Works great!
Putty on Windows
In windows I created a .bat file called adb.bat, where c:/adb/ is where I installed the SDK:
Code:
c:/adb/tools/adb remount
c:/adb/tools/adb forward tcp:9999 tcp:23
c:/adb/tools/adb shell telnetd
I run this file as Administrator, and then I can telnet into localhost:9999 with putty. Works great!

[Q] Overclock issue

I'm having an issue running the over clock command from this thread http://forum.xda-developers.com/showthread.php?t=1594804. When I run the CPU command, after I type /proc/overclock/ it creates a new line as I finish with the /mpu_opps, and it thinks I'm starting the command from the > /proc . It doesn't continue my command in one whole line. I don't know why when I get to the end of a line in the terminal window it jumps down to a new one. Can anyone shed some light?
Just to clarify you are doing the following and its going to a new line after the > symbol?
su (enter to get into rootspace note that it will change from app_********* to [email protected]*******)
echo 3 1200000000 62 > /proc/overclock/mpu_opps (enter)
echo 384000000 > /proc/overclock/gpu_opps (enter)
Whenever I do it it will continue to type on the same line and push back the echo like in the video.
Yes, that is correct.
All you have to do is permanently mod the file that starts the overclocking - see my posts on this page:
http://forum.xda-developers.com/showthread.php?t=1594804&page=3
Once you do that it automagically starts in overclocked mode every time without you having to mess with the terminal window or hooking up a USB-to-PC (ADB) session.

[Q] Mac Toolkit help please

I'm on the last step of mjphillips1981's mac toolkit for 4.4 rooting and it won't finish:
Code:
Press ENTER to finish the SlapMyMoto process.
Open a new terminal window by pressing Command+N
In the new terminal window type the following command
./adb shell echo "/data/local/tmp/install.sh" > /sys/kernel/uevent_helper
Press ENTER when you have finished the above command
I keep getting the error:
Code:
-bash: /sys/kernel/uevent_helper: No such file or directory
I've been at this all day
try this
open terminal
cd to the toolkit folder
type the following (one line at a time)
./adb shell
echo "/data/local/tmp/install.sh" > /sys/kernel/uevent_helper
I think these lines need to be separated.
Hit me up on Google+ and lets see if we can work through this.
An I would suggest that you put questions in the toolkit thread. I was just browsing and noticed this. If you put the question in the thread I get an email.
nwinston96 said:
I'm on the last step of mjphillips1981's mac toolkit for 4.4 rooting and it won't finish:
Code:
Press ENTER to finish the SlapMyMoto process.
Open a new terminal window by pressing Command+N
In the new terminal window type the following command
./adb shell echo "/data/local/tmp/install.sh" > /sys/kernel/uevent_helper
Press ENTER when you have finished the above command
I keep getting the error:
Code:
-bash: /sys/kernel/uevent_helper: No such file or directory
I've been at this all day
Click to expand...
Click to collapse
nwinston96 said:
I'm on the last step of mjphillips1981's mac toolkit for 4.4 rooting and it won't finish:
Code:
Press ENTER to finish the SlapMyMoto process.
Open a new terminal window by pressing Command+N
In the new terminal window type the following command
./adb shell echo "/data/local/tmp/install.sh" > /sys/kernel/uevent_helper
Press ENTER when you have finished the above command
I keep getting the error:
Code:
-bash: /sys/kernel/uevent_helper: No such file or directory
I've been at this all day
Click to expand...
Click to collapse
missed some commands it looks like but im not sure if anything is diffrent because your on a mac
but here is the step by step from jcase's thread
Step1)
Unzip SlapMyMoto-1,0.zip and push the jar file to your internal storage
Code:
adb push SlapMyMoto.jar /sdcard/SlapMyMoto.jar
Step2)
Use http://www.cydiaimpactor.com/ to open up a telnet session as system user on port 2222. We covered how to use Impactor and telnet in the RockMyMoto root, I won't be covering it again since this post is going to be long enough already, see here -> http://forum.xda-developers.com/show....php?t=2509590 or http://rootzwiki.com/topic/107098-ro...the-first-ota/
Connecting over telnet, and run Stage1 with this command:
Code:
dalvikvm -cp /sdcard/SlapMyMoto.jar SlapMyMoto
When the device tells you to reboot, do this manually with "adb reboot" or your power button. It will not auto reboot on this step
Step3)
Once the device has rebooted, run Impactor again and connect over telnet just like in the previous step, then run the same command
Code:
dalvikvm -cp /sdcard/SlapMyMoto.jar SlapMyMoto
Once the device has rebooted, please take the 4.4 OTA.
Step4)
Now that we are on 4.4, we can finish the process with adb shell:
Code:
adb shell
cp /sdcard/install.sh /data/local/tmp/install.sh
chmod 755 /data/local/tmp/install.sh
echo "/data/local/tmp/install.sh" > /sys/kernel/uevent_helper
dray_jr said:
missed some commands it looks like but im not sure if anything is diffrent because your on a mac
but here is the step by step from jcase's thread
Step1)
Unzip SlapMyMoto-1,0.zip and push the jar file to your internal storage
Code:
adb push SlapMyMoto.jar /sdcard/SlapMyMoto.jar
Step2)
Use http://www.cydiaimpactor.com/ to open up a telnet session as system user on port 2222. We covered how to use Impactor and telnet in the RockMyMoto root, I won't be covering it again since this post is going to be long enough already, see here -> http://forum.xda-developers.com/show....php?t=2509590 or http://rootzwiki.com/topic/107098-ro...the-first-ota/
Connecting over telnet, and run Stage1 with this command:
Code:
dalvikvm -cp /sdcard/SlapMyMoto.jar SlapMyMoto
When the device tells you to reboot, do this manually with "adb reboot" or your power button. It will not auto reboot on this step
Step3)
Once the device has rebooted, run Impactor again and connect over telnet just like in the previous step, then run the same command
Code:
dalvikvm -cp /sdcard/SlapMyMoto.jar SlapMyMoto
Once the device has rebooted, please take the 4.4 OTA.
Step4)
Now that we are on 4.4, we can finish the process with adb shell:
Code:
adb shell
cp /sdcard/install.sh /data/local/tmp/install.sh
chmod 755 /data/local/tmp/install.sh
echo "/data/local/tmp/install.sh" > /sys/kernel/uevent_helper
Click to expand...
Click to collapse
These commands are all in the toolkit. The only one that needed to be enter on individual lines is the one he listed.
I just wish he would have posted the question in the Toolkit thread so I could have helped earlier.
mjphillips1981 said:
These commands are all in the toolkit. The only one that needed to be enter on individual lines is the one he listed.
I just wish he would have posted the question in the Toolkit thread so I could have helped earlier.
Click to expand...
Click to collapse
Ok I have the toolkit for Windows but I'm not familiar with the Mac one thanks for correcting my mistake and getting him
Sent from my XT1056 using XDA Premium 4 mobile app
mjphillips1981 said:
try this
open terminal
cd to the toolkit folder
type the following (one line at a time)
./adb shell
echo "/data/local/tmp/install.sh" > /sys/kernel/uevent_helper
I think these lines need to be separated.
Hit me up on Google+ and lets see if we can work through this.
An I would suggest that you put questions in the toolkit thread. I was just browsing and noticed this. If you put the question in the thread I get an email.
Click to expand...
Click to collapse
Thanks, I think this did it. The only thing is that I had to manually reboot my phone, but it appears I am rooted as I'm able to run root-only apps. XDA wouldn't let me post on your thread because I don't have the required number of posts. Glad you came across this thread! Thanks again
nwinston96 said:
Thanks, I think this did it. The only thing is that I had to manually reboot my phone, but it appears I am rooted as I'm able to run root-only apps. XDA wouldn't let me post on your thread because I don't have the required number of posts. Glad you came across this thread! Thanks again
Click to expand...
Click to collapse
You're welcome! From what I read. Some people do experience that the phone does not reboot on its own.
Glad you got it working.
I just removed the toolkit. It's too hard to for me to get things working correctly when I do not have a consumer device to test with.

hwclock - how to update RTC to show correct time?

is there a way to force hwclock command to update real time clock on Nexus 6 to show correct time and date? it is just a little quirk that bugs me a little.
hwclock is a part of Toybox. The commands available are:
usage: hwclock [-rswtluf]
-f FILE Use specified device file instead of /dev/rtc (--rtc)
-l Hardware clock uses localtime (--localtime)
-r Show hardware clock time (--show)
-s Set system time from hardware clock (--hctosys)
-t Set the system time based on the current timezone (--systz)
-u Hardware clock uses UTC (--utc)
-w Set hardware clock from system time (--systohc)
Install terminal emulator from the Play Store. Open terminal emulator and issue the command hwclock -w, which should do what you want. If terminal emulator complains that it needs root, you'll have to root then issue the command with root privileges. Now, because doing that all the time manually can get tiresome, you'll want to look into automating the process by writing a script that executes every time the device is rebooted.
Strephon Alkhalikoi said:
hwclock is a part of Toybox. The commands available are:
usage: hwclock [-rswtluf]
-f FILE Use specified device file instead of /dev/rtc (--rtc)
-l Hardware clock uses localtime (--localtime)
-r Show hardware clock time (--show)
-s Set system time from hardware clock (--hctosys)
-t Set the system time based on the current timezone (--systz)
-u Hardware clock uses UTC (--utc)
-w Set hardware clock from system time (--systohc)
Install terminal emulator from the Play Store. Open terminal emulator and issue the command hwclock -w, which should do what you want. If terminal emulator complains that it needs root, you'll have to root then issue the command with root privileges. Now, because doing that all the time manually can get tiresome, you'll want to look into automating the process by writing a script that executes every time the device is rebooted.
Click to expand...
Click to collapse
yeah that's what I'm doing but it doesn't work as advertised. hwclock returns with an error:
hwclock: RTC_SET_TIME: Invalid argument
Best guess here is that Motorola didn't enable the function to write to the hardware clock.

super user dumpsys won't provide global results

I am running the command dumpsys using the following command line.
su -c dumpsys window windows | grep mCurrentFocus
I am getting the result mCurrentFocus=null
When I run from the shell window (adb shell)
dumpsys window windows | grep mCurrentFocus
I get the correct result (I correctly get the program launcher)
mCurrentFocus=Window{f7ca03b u0 com.anddoes.gingerapex/com.anddoes.launcher.Launcher}
It looks like su is only letting me access a subset of results related to the calling application.
Is there a way to get the global results.
Thanks!
atomclock said:
I am running the command dumpsys using the following command line.
su -c dumpsys window windows | grep mCurrentFocus
I am getting the result mCurrentFocus=null
When I run from the shell window (adb shell)
dumpsys window windows | grep mCurrentFocus
I get the correct result (I correctly get the program launcher)
mCurrentFocus=Window{f7ca03b u0 com.anddoes.gingerapex/com.anddoes.launcher.Launcher}
It looks like su is only letting me access a subset of results related to the calling application.
Is there a way to get the global results.
Long story short... I have written a task killing application and I don't want to kill the topmost application.
Thanks!
Click to expand...
Click to collapse
Task killing app is useless since Android managing the RAM pretty well.
You can try out with this:
https://developer.android.com/reference/android/app/usage/UsageStatsManager
Basically set the start time when your service start working and end time let it be current one, so it can get the top most running app in that n secs of amount of time you added.
Sent from my Redmi Note 8 Pro using Tapatalk

Categories

Resources