9/09/2013

Custom the display of Operator name via Tasker

The figure following show the custom operator of mine:


The setting UI for custom operator name:



Hereinafter I will show you how to custom the display of operator name via Tasker.

I found the system save the operator name in /data/data/com.android.providers.settings/databases/settings.db

The system table of Setting.db contains operator name-value pairs(records, its professional name). We need to change the value of specific SIM operator.



Note that table may have more than one records whose name with “MOBILE_OPERATOR_NAME_” prefix. Trial and error, I found the numbers which following “MOBILE_OPERATOR_NAME_”, mean the MCC+MNC part of IMSI. In China, 46001 means China Unicom, While 46000, 46002,46007 mean China Mobile Communication(CMCC for short).

But how can Tasker judge the SIM inserted represent which operator? Firstly, you may think of specific part of phone number. But here I will tell you that Android saystem can’t get the exact phone number for some new SIM card unfortunately. I got nothing with my SIM card of CMCC when I try to use the built-in variable %PNUM.

Things seem to be stuck for a time. Finally the problem was solved when I know the first 6 characters of SIM numbers(refer to ICCID) differ from operators internationally. ASAIK, 898600 was assigned to CMCC while 898601 was assigned to China Unicom. So I get my ideas into shape finally.



Tips: You can set special characters or symbols as personalized operator name. A simple way is to use special symbols in Input Method.

As for detailed steps, you can see below.

         Step 1: Variable Clear [ Name:%Runcmd Pattern Matching:Off ]
Clear the query variable

         Step 2: Variable Query [ Title: Please Input Custom Operator Name: Variable:%Runcmd Input Type:Normal Text Default: Background Image: Layout:scene_VarQuery Timeout (Seconds):40 Show Over Keyguard:On ]

         Step 3: Stop [ With Error:Off Task: ] If [ %Runcmd ! Set ]

         Step 4: Variable Set [ Name:%sim To:%SIMNUM Do Maths:Off Append:Off ]

         Step 5: Variable Section [ Name:%sim From:1 Length:6 Adapt To Fit:Off Store Result In:%sim ]

         <CMCC>
         Step 6: Variable Set [ Name:%spn_list To:46000,46002,46007 Do Maths:Off Append:Off ] If [ %sim = 898600 ]

         <China Unicom>
         Step 7: Variable Set [ Name:%spn_list To:46001 Do Maths:Off Append:Off ] If [ %sim = 898601 ]

         Step 8: Variable Split [ Name:%spn_list Splitter:, Delete Base:Off ]
         
         Step 9: Airplane Mode [ Set:On ]

         Step 10: For [ Variable:%spn Items:%spn_list() ]

         <only change specific SIM operator name>
         Step 11: Run Shell [ Command:sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update system set value='%Runcmd' where name='MOBILE_OPERATOR_NAME_%spn'" Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: Continue Task After Error:On ]

         Step 12: End For 

         <change all SIM operator name>
         Step 13: [X] Run Shell [ Command:sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update system set value='%Runcmd' where name like 'MOBILE_OPERATOR_NAME_%'" Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: Continue Task After Error:On ]


         Step 14: Airplane Mode [ Set:Off ]

Note: If you want to change current SIM operator in China, use step 1-2,14. Well, if you want change all SIM operator name in China, use step 1-3,9,13,14. 

No comments:

Post a Comment