Data communication and dialing secret codes

559 views
Skip to first unread message

Jennete Smith

unread,
Jul 26, 2014, 10:22:34 AM7/26/14
to tas...@googlegroups.com
After discovering a way to communicate and trigger tasks vis data sms, I would like to take a step up by transferring non text formats and larger data to the device without user interaction. Breaking up large files to 133 bytes for data is possible,but tasker does not, from what I know, support extracting multi parts zip.

Also, I have some secret codes, which are by the way, numbers that you type in the dialer to trigger a rask, app, or carrier level mumbo jumbo, that I would like to be trigger by tasker. I found that auto dialing via tasker works, but only for codes that are at a carrier level. So when a secret code is at a device level or airplane mode is on, these code cannot be trigger by dialing via tasker with or without auto dial check. It seems like the dialer only detects the code when # is manually pressed in the dialer. Are there anyway around this?

I would be greatly grateful if anyone could give me some pointers.

Marta Hintz

unread,
Jul 26, 2014, 1:41:41 PM7/26/14
to tas...@googlegroups.com
can't give you any help here,but that sounds really intriguing.

Jennete Smith

unread,
Jul 26, 2014, 3:26:43 PM7/26/14
to tas...@googlegroups.com
How about this? Since this has bother me in the longest time possible, I will give a $10 Google Play Credit to the person who can fully answer my questions.

Jennete Smith

unread,
Jul 26, 2014, 11:28:41 PM7/26/14
to tas...@googlegroups.com
Shameful bump with more shameful bribe. Giving out $20 Google Play credit now!

Matt R

unread,
Jul 30, 2014, 6:00:05 PM7/30/14
to tas...@googlegroups.com
You can read and split any file using the following method:
  1. File > Read Binary action on whatever file
  2. Variable > Variable Search Replace action using a regex like (?s).{1,%size} and saving matches in an array like %chunk
  3. For loop to do the File > Write Binary for each item in the resulting %chunk array
Make sure that the %size you use is a multiple of 77 (it took me about 3 days to figure that out).  This is due to there being a line break after each set of 76 characters.  To recombine the constituent files, just reverse the process by using a for loop to do a File > Read Binary action and Variable > Variable Set with append checked to add all the parts to a single variable and then File > Write Binary to write that combine variable to a file.  Make sure you keep track of the file extension (e.g. .jpg, .pdf, etc.)

For "secret codes", it depends on what exactly the format for the secret code you're talking about is.  If it's the *#SomeNumbers#*, you can use the intent:
Action: android.provider.Telephony.SECRET_CODE
Data: android_secret_code://SomeNumbers

There are other methods for the "secret code dialing" if the above doesn't work.

Matt

Jennete Smith

unread,
Jul 30, 2014, 7:06:53 PM7/30/14
to tas...@googlegroups.com
Interesting. Thank you for the through post. I will try this when I get home.

The secret code is of this format **05*[OldCode]*[NewCode]*[Retypenewcode]#

Dialing the code does not work. What are your other methods?

Matt R

unread,
Jul 30, 2014, 7:21:52 PM7/30/14
to tas...@googlegroups.com
I assume you tried different iterations in the intent?  One thing I found online is you might need to URI encode the # (pound sign), which the encoded value is, I believe, %23.  So you could try some things in the data field like:

android_secret_code://**05*old*new*new%23

OR

android_secret_code://*05*old*new*new

You said in your other post that this is for the SIM card?  You could look through the android manifest for whatever SIM card .apks your device has.  An easy way to view them is with this app: https://play.google.com/store/apps/details?id=com.electricsheep.asi

Maybe post a copy of any relevant android manifests.

Matt

Jennete Smith

unread,
Jul 30, 2014, 8:13:20 PM7/30/14
to tas...@googlegroups.com
Woah, thank you for the through instructions, Matt. I am on a mobile phone, so I cannot fully express my gratitute. Of course, I will give you the Play credits as soon as I am home and finish with this.

I am currently trying the app you suggested, but it cannot seem to find keyguard.apk, which is where the lock is stored, from my long observation. I do not have the fastest Internet right now as I am out and about; do you mind if you can pull up your androidmanifest on your device?

Jennete Smith

unread,
Jul 30, 2014, 8:35:04 PM7/30/14
to tas...@googlegroups.com
I found it.


<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:sharedUserId="android.uid.systemui" coreApp="true" package="com.android.keyguard">
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.STATUS_BAR"/>
<uses-permission android:name="android.permission.DEVICE_POWER"/>
<uses-permission android:name="android.permission.MANAGE_USERS"/>
<uses-permission android:name="android.permission.MANAGE_APP_TOKENS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<uses-permission android:name="android.permission.BIND_APPWIDGET"/>
<uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW"/>
<uses-permission android:name="android.permission.BIND_DEVICE_ADMIN"/>
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL"/>
<uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE"/>
<uses-permission android:name="android.permission.BROADCAST_STICKY"/>
<uses-permission android:name="com.sonymobile.permission.SHOW_LOCKSCREEN_WALLPAPER"/>
<application android:label="@string/app_name" android:persistent="true" android:process="com.android.systemui" android:supportsRtl="true">
<meta-data android:name="com.sonymobile.runtimeskinning.LAF_VERSION" android:value="1"/>
<service android:exported="true" android:name=".KeyguardService"/>
</application>
</manifest>

Matt R

unread,
Jul 30, 2014, 9:33:42 PM7/30/14
to tas...@googlegroups.com
I didn't really do it for credits as much as the interesting challenge.  Especially when I could not, for the life of me, get the binary read > split > binary write actions working as expected.  The line break was key.

As this is for SIM interaction, I imagine a reasonable level of security will be present that may not be possible to overcome.

Matt

Matt R

unread,
Jul 30, 2014, 9:36:20 PM7/30/14
to tas...@googlegroups.com
Unfortunately this shows that there isn't a simple broadcast receiver present as there is for other android "secret codes".  Next to try would probably be seeing if the input > type actions work on the lockscreen dialer.

Matt

Matt R

unread,
Jul 30, 2014, 9:45:53 PM7/30/14
to tas...@googlegroups.com

Jennete Smith

unread,
Jul 30, 2014, 10:55:12 PM7/30/14
to tas...@googlegroups.com
I should emphasize that I am not trying to bypass the keyguard. I do have the entire code. I am just trying to automate the tedious process. There might be someway to make tasker input the data onto the pinpad, but I haven't figure a way out... Seems like I have to mess around a little more.

Matt R

unread,
Jul 31, 2014, 1:17:45 AM7/31/14
to tas...@googlegroups.com
That's what I was suggesting with the input > type action. See if you can get it to type on the dialer.

Matt

Jennete Smith

unread,
Jul 31, 2014, 2:56:13 PM7/31/14
to tas...@googlegroups.com
After updating to the latest tasker, dialing the "secret code" when the sim is locked works. It successfully unlock the screen. But there is still one more thing I am trying to figure out: can I hide the sim pin pad at all times? Unfortunately, I still have to wait 4 seconds during boot up time before tasker wakes up and unlocks the screen. I try freezing keyguard.apk, and it does hide the pinpad, but the home and multitask softkeys cannot be used. And what if I have a traditional pin code that is not the sim code? It gets bypassed. I need a way to only bypass the keyguard until the sim is unlocked, dismissed the popup that tells me that it is unlocked, and then relock the keyguard again.

Matt R

unread,
Jul 31, 2014, 3:18:30 PM7/31/14
to tas...@googlegroups.com
I didn't follow that entirely.  How did you get it working?

Try the secure settings plugin for disabling/enabling the keyguard.

Matt

Jennete Smith

unread,
Aug 1, 2014, 11:28:35 PM8/1/14
to tas...@googlegroups.com
I basically called a number when the sim was locked. It didnt work in a previous version of tasker, but it works now.

Right now, I am trying to detect and close a system dialog whenever it opens.

By the way, while you didn't fully answer my questions, I really want to show my appeciation to people like you, making part of their time to help others. I want to give you a $10 gift card because of it. Where do you want me to e-mail it to?

Brandon Horwath

unread,
Aug 1, 2014, 11:46:19 PM8/1/14
to tas...@googlegroups.com
Right now, I am trying to detect and close a system dialog whenever it opens.

%WIN might help with detection. There is an action > close system dialogue, that has worked for me with those pesky popups.

Usually, I'll work the action into the task flow itself if I can't determine it's appearance.

Matt R

unread,
Aug 2, 2014, 2:18:46 AM8/2/14
to tas...@googlegroups.com
If the close dialogues action doesn't work, next step would be screen taps using the shell command "input tap <x> <y>".

Matt

Jennete Smith

unread,
Aug 2, 2014, 3:13:33 PM8/2/14
to tas...@googlegroups.com


I am trying to get ride of this popup, and closing system dialog doesn't work. Could you please elaborare how to yse %Win in conjuction to this popup, please?

Brandon Horwath

unread,
Aug 2, 2014, 3:37:01 PM8/2/14
to tas...@googlegroups.com
A profile like this would alert you to a unique window value present, and display the value (provided one exists when window appears).

Event: Variable Set [ Variable:%WIN Value:* ]
Enter:
Abort Existing Task

A1: Flash [ Text:%WIN Long:Off ]

If a unique value is present, you can use it in a profile context, or work the recognition of the window event into the task itself.

Matt R

unread,
Aug 2, 2014, 5:15:24 PM8/2/14
to tas...@googlegroups.com
Easiest might be input > button > back.

Matt

Jennete Smith

unread,
Aug 3, 2014, 12:43:58 PM8/3/14
to tas...@googlegroups.com
The %win method doesn't return any result. The keyguard pops over the popup, so I cannot emulate a back unless I trigger one everytime the keyguard is unlocked... Hehe... This is really getting annoying. Thank you for all the suggestion thus far, it really had help me a lot.

Matt R

unread,
Aug 3, 2014, 12:53:50 PM8/3/14
to tas...@googlegroups.com
Huh? I didn't really follow that. Be explicit about what's happening. Are you trying to find a way to interact with the pop-up or detect it? Did you try stimulating screen taps with the shell command "input tap <x> <y>"?

Matt

Jennete Smith

unread,
Aug 3, 2014, 1:35:50 PM8/3/14
to tas...@googlegroups.com
Sorry for not being concise enough. I am typing on my phone.

Here is what happen:

1) The phone boots up, shows the keyguard, asking for the pin to be input. You cannot escape this screen, with only the emergency dialer available. Cellular signal is unavailable until password is inputted.

2) Tasker kicks in after 5 seconds, dial the number and cell is activiated.

3) The regular keyguard is shown(swipe, pin, pass at hardware level).

4) Once unlocked, the cursed popup awaits.

So my question is:
How do I decrease the time between the boot up and when Tasker kicks in? Even by making my project a system app, there is still a significant time to wait. Using a 3rd party lockscreen will instantly bypass the Sim check at bootup, but I prefer the traditional lock from aosp.

How can I get rid of that popup? I know it's a small thing, but I really want to get rid of it.

Matt R

unread,
Aug 3, 2014, 6:32:15 PM8/3/14
to tas...@googlegroups.com
You can't make Tasker "kick in" any sooner.

Make the dismissal of that pop-up part of your boot up sequence. Use something like secure settings to remove the keyguard, dismiss the pop-up with a back button or screen tap, then re-enable the keyguard. Or just use a variable to dismiss the pop-up the first time you unlock after boot (but not subsequent times).

Matt

Reply all
Reply to author
Forward
0 new messages