[Q] How to use multiple "IF" - Zooper Widget General

hello i wanted to know how exactly should i write it down so that i can make different situations for example
if its x=1 new address else if x=2 new address else if x=3 new address and etc
i think im having problem with the $ placement, i wrote
$x=0?*b*/sdcard/*/b*:x=2?*b*/sdcard/*/b*:x=30?*b*/sdcard*/b*$
the /sdcard/ was just example i did include the real address on the code
where ever you see * i meant [ or ] it just xda forum changes it to BOLD so i couldnt write and after [/b

vitalero said:
hello i wanted to know how exactly should i write it down so that i can make different situations for example
if its x=1 new address else if x=2 new address else if x=3 new address and etc
i think im having problem with the $ placement, i wrote
$x=0?*b*/sdcard/*/b*:x=2?*b*/sdcard/*/b*:x=30?*b*/sdcard*/b*$
the /sdcard/ was just example i did include the real address on the code
where ever you see * i meant [ or ] it just xda forum changes it to BOLD so i couldnt write and after [/b
Click to expand...
Click to collapse
Zooper doesn't support nested conditions, so you can't to if-else conditionals. As long as your situations are not overlapping and only one condition is true at the same time, you can just write them as multiple single conditionals to work around this.

could you give me an example? i made 10 different situations and only 1 can be true at each time
and each time that it changes it takes a different file with the [/b command

vitalero said:
could you give me an example? i made 10 different situations and only 1 can be true at each time
and each time that it changes it takes a different file with the [/b command
Click to expand...
Click to collapse
Something like this:
Code:
$#situation#=1?<whatever you want for that condition>$
$#situation#=2?<whatever you want for that condition>$
$#situation#=3?<whatever you want for that condition>$
$#situation#=4?<whatever you want for that condition>$
...
This is obviously just an example to give you the general idea. I'm sure you are able to work your conditions and output into it

Thanks mate works just fine

Related

Another volunteer project: IIWPO (theft protection)

I need (or in fact, we all need...) someone that can read and write to the registry and send SMS messages in C++. (A code example for sending SMS is here)
The objective here is to create a program which we can include in the ROMkitchen and which will allow for theft-protection of the device. Basically when you select this option, you enter the GSM number of a friend and your name at the time you create the ROM. The device regularly checks whether your name still appears in the Owner Information. If not, it sends an SMS to your friend, including the new owner info, and then it is silent until the Owner Information changes again.
More formally:
Code:
Loop forever
SLEEP 1 hour
IF reg-key '\HKEY_CURRENT_USER\ControlPanel\Owner'
value 'Owner' != reg-key '\HKEY_CURRENT_USER\
Software\XDA-developers\IIWPO' value 'LastOwner'
THEN
COPY 'Owner' to 'LastOwner' (See above)
IF value 'Owner' doesn't contain the string
held in '\HKEY_CURRENT_USER\Software\
XDA-developers\IIWPO' value 'Name' THEN
Send data from Owner field above
via SMS to number held in '[...]IIWPO'
value 'Number' (REG_SZ)
Only slightly complicating factor is that the 'Owner' field is a binary field holding unicode, and that I'd like the 'Name' field in our own entry to be REG_SZ because ROMkitchen does that without hassle. But otherwise this is all pretty straightforward.
Because our IIWPO (which, by the way, stands for 'Interesting Interaction With Previous Owner') program is meant to be in 'Startup', it would be nice if memory footprint was as small as possible. Since it's going to sleep most of the time, performance should be unaffected no matter what.
The sleep is at the beginning so that you have one hour after a cold boot to set your name before it starts sending the SMS.
Ofcourse everyone that has read this could change the registry. We're assuming for a moment that it's much more likely that your phone will be stolen by someone that didn't read this. A little Security By Obscurity never hurt anyone.
I just wonder
very interesting concept, very...
I can code this feature easy, but I just wonder: what to say, if your stoles device will stay hundreds kilometers away from you a few days later? ask the new owner to mail it to you?
hmmm? maybe it is worth?
improve the concept
I have an idea to improve the above concept:
1. we can save the original owner and "sms to send" number in the random generated register key, encrypted binary - it will be hard to find and delete for most of users
2. we provide a shortcut to the application allows the oroginal user to run it and type the name and the above number and save
3. after the above point 2 happen once, the shortcut and even the application are deleting completely, so nobody can do that again
the quextion is:
the execute part of the application: to check the current name and eventually send the sms, have to be placed in the Startup folder to run after the reset. How to hide this shortcut?
Re: improve the concept
JGUI said:
1. we can save the original owner and "sms to send" number in the random generated register key, encrypted binary - it will be hard to find and delete for most of users
Click to expand...
Click to collapse
Nice idea: but any thief that knows about this danger will just cook themselves a new ROM and install it.
2. we provide a shortcut to the application allows the original user to run it and type the name and the above number and save
Click to expand...
Click to collapse
Why not just do it in the ROMkitchen?
And besides, it already done: a kind gentleman by the name of Charles Warner has written the app, and it'll be in the ROMkitchen later today, hopefully...

[HOWTO][INFO]Editing the CSC file on your phone.

All samsung "touchwiz" based devices contain files in /system/csc that set variables dictating how certain parts of the phone act, what is pre-configured, etc. In the case of the AT&T variants, the contents of these files are often dictated by AT&T.
This post is an attempt to try and catalog some of the more useful values that can be changed (and the result of changing them.) Not all the variables seem to do much, and only by trial and error can we really know what will happen... So far, I've only played around with items I found interesting, but will continue to expand in this and if people reply to this post with actual experience changing other variables, I'll add the information to this thread.
PLEASE TEST THINGS AND CONTRIBUTE TO THIS THREAD.
Please don't reply with guesses as to what things may or may not do or with requests about specific variables. I'm hoping that eventually document every CSC variable available and "requests" won't make it go faster. If you want to know what a not-yet-documented variable does, try it out (and post your results.)
First, in order to play with the csc files, your phone should be rooted. This isn't optional, as you'll need the ability to overwrite files in the phone's /system partition (the firmware - sometimes improperly called the "ROM")
I'd strongly suggest making a nandroid (or backup via CWM Recovery or TWRP) before making changes. It's possible to mess things up badly enough that the phone won't boot properly.
It's possible to edit the CSC files directly on the phone, but I'd strongly suggest not doing that. Therefore, you should have a good text editor on your computer that's able to properly deal with unix/linux style line endings (notepad isn't good enough.) Notepad++ is a very good editor and freely available. Google "notepad++" For a linux box, plain "gedit" is fine.
In order to edit the files, you'll need to be able to mount the /system partition as read-write, and to move files from /system/csc to your PC or other location for editing. You have several options for this including root explorer, ES File Explorer, or just using adb. I prefer adb myself, but I'm a commandline type of person.
I won't be spending time describing how to get the CSC files off your phone to your PC, nor will I tell you how to overwrite the existing ones with your edits. This isn't because I'm elitist, an a**hole, or anything like that. (I _am_ some of those things, but that isn't my reason here.) My purpose for leaving out the information is to force inexperienced users to learn these things before editing system files. If I give you all the information, you become dependent on me for more information, and I don't want that (and trust me - neither do you.) As well, if I spoon-feed this, you won't have any idea what do to when something goes wrong.
Find this post helpful? If so, please make it MORE helpful by testing one of the other CSC features and replying to this thread telling us what result you had. ​
First up... feature.xml...
feature.xml
The CSC "feature.xml" file is in XML format. This means that everything "variable" has a start and end tag. Both contain the name of the variable,
but the end tag has a slash in it. The value of the variable is between the start and end tags. For example: <VariableName>value</VariableName>. So, if this message describes changing "CscFeature_SamsungSucks" from "false" to "true", you'd search in the xml file for "CscFeature_SamsungSucks" and might find this:
Code:
<CscFeature_SamsungSucks>false</CscFeature_SamsungSucks>
You'd change the "false" to "true" (no quotes!) and be done. In some cases, the entire line can be deleted (as noted.)
This file has a LOT of variables in it and this post will concentrate on that particular file. Almost all tinkering will occur in this file, and it's also the easiest to edit (as there aren't any complex xml structures.)
CscFeature_Common_DisableMenu4GalSearch: setting this to false didn't seem to bring up any new global address list options on my device (I'm connected to an exchange server) in the email app or contacts/dialer app.
CscFeature_Settings_DisableMenuFindMyMobile: (see next line)
CscFeature_Settings_FindMyMobile: setting "DisableMenuFindMyMobile" to false and this entry to true will enable the "find my mobile" entries in the Settings->Security menu. I'm unable to get these items to function properly, however. (They worked with my international note2, so it might be that there are other support files missing on the AT&T variant I'm using now.)
CscFeature_FMRadio*: editing these seem to have no effect (I don't think any of the LTE capable NoteII phones are capable of FM Radio.)
CscFeature_NFC_StatusBarIconType: If you delete this line, it will get rid of the "N" statusbar icon when NFC is turned on.
CscFeature_Message*: Be warned that editing some of these may break SMS/MMS messaging on your device. There appears to be many carrier specific settings in here that have dependencies on the specific carrier. For example, I don't think that AT&T's network supports proper SMS Delivery reports, so even setting the corresponding variable to "true" would be futile.
CscFeature_Email_UseFixedBgColorAsWhite: if changed from true to false, the email app will appear inverted (with a black background and white/gray text.)
CscFeature_Sip_DisableAutoCorrection: doesn't seem to have any impact on the samsung keyboard
CscFeature_Sip_DisableSpaceSuggestion: doesn't seem to have any impact on the samsung keyboard
CscFeature_Sip_DefaultOff4AutoSubstitution: doesn't seem to have any impact on the samsung keyboard
CscFeature_Launcher_*: all these seem to be for setting defaults for the touchwiz launcher, so no sense in changing them.
language.xml
(coming soon)
This appears to control what languages are available to the system. Canadian users might want to play with this file to see if adding en_US to the "Display" and/or "SupportList" tags will allow them to choose US English (and perhaps get google's TTS to talk to them in google now.)
others.xml
(coming soon)
This appears to set some carrier defaults, including the APN information and the carrier built-in dialer contacts (such as "AT&T Customer Care")
customer.xml
(coming soon)
I've only glanced at this file so far, but it appears to be carrier specified network information, some carrier specified settings defaults, and even some carrier specified browser bookmarks. There also appears to be some APN related information in here, but I'm not certain what it's in here for.
Nice how to guide man its very informative, im going to play around with this later when I get home...do you mind if I add it to my reference thread so it doesnt get lost when this thread begins to get bigger?
Sent from my SAMSUNG-SGH-I317 using xda premium
mjwhirly said:
Nice how to guide man its very informative, im going to play around with this later when I get home...do you mind if I add it to my reference thread so it doesnt get lost when this thread begins to get bigger?
Click to expand...
Click to collapse
This isn't mine to control. This "belongs" to the community, and I hope that the community contributes to it in a meaningful way. Please feel free to reference it elsewhere - perhaps with (contributions welcome) noted. My ONLY demand is that no one profits from effort I've given freely.
My secret motive is to nudge people out of the "MyRom" mentality and more into the "lets all work together to learn, develop and share" mentality often seen with kernels and open source projects.
Take care
Gary
Gary, have you seen the CSC feature web, set user agent?
Possibly an option to set "Desktop" as default user agent in browser, I for one despise mobile sites.
antiochasylum said:
Possibly an option to set "Desktop" as default user agent in browser, I for one despise mobile sites.
Click to expand...
Click to collapse
Not sure if this is what you are looking for or not: Start the browser, tap the "menu" button. Turn on the "desktop view" checkbox.
There are some UAgent related entries in the feature.xml file. Please play with them and post your results:
CscFeature_Web_SetUserAgent // currently empty
CscFeature_Web_SetUAProfile
CscFeature_Web_Bool_EnableUAProfile // currently false
Thanks so much for this. Sorry for the noob question but I haven't done much with xml files. What is the character to just comment out a line?
Sent from my SAMSUNG-SGH-I317 using xda premium
Romee74 said:
Thanks so much for this. Sorry for the noob question but I haven't done much with xml files. What is the character to just comment out a line?
Click to expand...
Click to collapse
In XML, in order to comment out a line (instead of completely deleting it), it has to be surrounded by special tags:
On the left of the commented out area, you need "<!--" (no quotes) and on the right, you need "-->"
See the below code block for an example.
Code:
<Is_This_Commented> false </Is_This_Commented>
<!-- <Is_This_Commented> true </Is_This_Commented> -->
Take care
Gary
On my Galaxy S III, the file /system/etc/feature_default.xml appears to contain default settings, and feature.xml can override those defaults. I'm not sure how comprehensive the list of settings in feature_default.xml are, but I would imagine that many of the available ones are covered there.
Thundersnuz said:
On my Galaxy S III, the file /system/etc/feature_default.xml appears to contain default settings, and feature.xml can override those defaults. I'm not sure how comprehensive the list of settings in feature_default.xml are, but I would imagine that many of the available ones are covered there.
Click to expand...
Click to collapse
That's interesting. Which variant of sgs3 do you have? Would you be willing to attach the two files to a reply in this thread (or point me to someplace I can find the firmware your using to investigate?)
Thank you
Gary
It would be amazing if we could somehow enable auto-replace on the samsung keyboard. I ended up switching to swiftkey because of how many mistakes I've been making with the stock keyboard, but now I don't get to take advantage of swipe, stylus writing, or the one-handed features...
UCLAKoolman said:
It would be amazing if we could somehow enable auto-replace on the samsung keyboard. I ended up switching to swiftkey because of how many mistakes I've been making with the stock keyboard, but now I don't get to take advantage of swipe, stylus writing, or the one-handed features...
Click to expand...
Click to collapse
I completely agree, but I wasn't able to get it working when tinkering with the CSC values (as noted in the corresponding post.) Perhaps there's some other combination of values that might get it going.
Please give it a try and let us know how it works out.
Take care
Gary
Removing the NFC icon from the staus bar is awesome but has anyone tried switching this line;
<CscFeature_NFC_DefaultCardModeConfig>DISABLE</CscFeature_NFC_DefaultCardModeConfig>
To enable? Im not sure why att would "block" this feature, especially with google wallet getting more support for non-nfc devices.
Sent from my SAMSUNG-SGH-I317 using xda app-developers app
MonsterBandit said:
...but has anyone tried switching this line...
Click to expand...
Click to collapse
I'm not sure why people keep asking if other people have done this, that, or the other thing. TRY IT and let us know what happens.
garyd9 said:
I'm not sure why people keep asking if other people have done this, that, or the other thing. TRY IT and let us know what happens.
Click to expand...
Click to collapse
fair enough...thanks btw...im slowly growing the courage to make changes and explore deeper into these devices...changed the value to "ENABLE" (minus the quotes) and seemingly nothing changed. Google Wallet app still says Not supported. That might be on Google Wallet's end tho. I guess the better question might be has anyone with a Note 2 gotten Google Wallet to work?
When I first got my GN2 running stock, carrier billing worked. I then flashed Jedi 3.3, and it disappeared. I remember that on my HOXL, someone mentioned a fix on the build.prop. Is there anything I can do on the GN2's build.prop to get my carrier billing back?
I'm on AT&T by the way.
silentecho13 said:
When I first got my GN2 running stock, carrier billing worked. I then flashed Jedi 3.3, and it disappeared. I remember that on my HOXL, someone mentioned a fix on the build.prop. Is there anything I can do on the GN2's build.prop to get my carrier billing back?
I'm on AT&T by the way.
Click to expand...
Click to collapse
this is pretty much a how to thread ..
you seem to be having issues with a rom , you should post in there ..
here is how I fixed it in previous roms ..
compare your build.prop form your att rom to the one you are using ..
and add / replace with the att stuff .

Hardcoded Password in GPS Library

Hey everyone, I've been a lurker for quite sometime, so I'm finally posting something. This is isn't in any of the dev sections because this is my first post.
When I first got my GNex (toroplus) was very annoyed with the capabilities of the gsd4t gps chip. Static navigation makes it really hard to use the chip for telemetry projects and the 1Hz position update doesn't give me enough sample data for the things I'm working on. I decided to do some investigation to see if it was limited to the hardware itself or the driver.
I scoured the forum, and tried a bunch of apps, found datasheets and the what not and nothing really improved my situation. I decided to take matters into my own hands and poke around lib_gsd4t.so (stock).
With verbose logging turned on, I noticed an interesting looking entry.
Code:
Hello EE downloder !!!.
{sgee.samsung.csr.com, instantfix.csr.com}, port : 80
Y3Nyc2xsOmROTkw5NnN1, /diff/packedDifference.f2p3enc.ee, format 2
EE_DOWNLOAD: EE_Download_Init done.
EE_Download_Init - returned 0 !!!.
EE_DOWNLOAD: EE_Download_Start successful.
EE_DOWNLOAD:EE_Download_Scheduler started; server_address=(sgee.samsung.csr.com,instantfix.csr.com), port=80, file=/diff/packedDifference.f2p3enc.ee
...
The string Y3Nyc2xsOmROTkw5NnN1 really stuck out to me. The character set fit in the base64 space which for some reason or another, developers seem to think base64 encoded text is somehow a good way to make things more secure. I have seen this numerous times. To me, it just makes it more noticeable that someone is trying to hide something.
So I went ahead and decoded the string and got
Code:
csrsll:dNNL96su
Just to be sure it wasn't some string unique to my phone, I checked where it most likely came from, which is the lib_gsd4t.so and it is indeed there (@offset 0x1b7429).
What's so special about that string?
I'm almost 100% sure that it is the username : password combo for downloading the SGEE data. I'm guessing it is using a post request (anyone wanting to use wireshark to packet sniff this can confirm) because there are extra parameters being used to retrieve the data.
Have I tried to access the file with those credentials?
No.
Why am I posting this?
I thought it was funny that the username and password are hardcoded in the driver and written to the logs. What's the point of having it password protected if you're just going to tell everyone the account credentials?
My actual job involves application security and I used this as an example for the other programmers on my team as to why we shouldn't ever mistake encoding for encryption and if you try to hide something, chances are you are actually drawing attention to it.
Oh also, is anyone interested in knowing more about the library. I have figured out quite a bit
How odd!
If you've figured out the gps drivers maybe you know how to make an updated file to disable static navigation? I op'd this thread http://forum.xda-developers.com/showthread.php?p=38684789 based on the ics version, but would love an android 422 based mod.
I posted my modded drivers. It may also require new configs.
afrotronics said:
I posted my modded drivers. It may also require new configs.
Click to expand...
Click to collapse
Did you ever figure out the proper request? (curl or wget?)

[Q] Contacts not recognized when first name contains Umlaut (ä, ö, ü) or ß

Hi,
if you want to phone somebody - let's call him Jochen Altmann - you can dial J-O-C... (5-6-2...) and the contacts get checked for matches. The more letters you type, the less possible hits are displayed. This also works when you start by typing the last name A-L-T...
Strangely, this does not work if the first name contains an Umlaut (ä, ö, ü) or a German ß. If that is the case, the contact won't be displayed. E.g. if I wanted to call 'Jürgen Altmann', neither typing J-Ü-R... (5-8-7...) nor A-L-T... makes the contact show up. The contact is totally ignored, as if it didn't exist.
This problem does NOT appear, if only the LAST name contains ä, ö, ü or ß.
Also, the problem does NOT appear, if the first name contains any other special letter like é.
The problem seems to affect a number of people, not only my phone. And it seems to be a Fairphone issue, not an Android issue.
Any solution available?
Best,
smartn
Hi,
smartn said:
Hi,
if you want to phone somebody - let's call him Jochen Altmann - you can dial J-O-C... (5-6-2...) and the contacts get checked for matches. The more letters you type, the less possible hits are displayed. This also works when you start by typing the last name A-L-T...
Strangely, this does not work if the first name contains an Umlaut (ä, ö, ü) or a German ß. If that is the case, the contact won't be displayed. E.g. if I wanted to call 'Jürgen Altmann', neither typing J-Ü-R... (5-8-7...) nor A-L-T... makes the contact show up. The contact is totally ignored, as if it didn't exist.
This problem does NOT appear, if only the LAST name contains ä, ö, ü or ß.
Also, the problem does NOT appear, if the first name contains any other special letter like é.
The problem seems to affect a number of people, not only my phone. And it seems to be a Fairphone issue, not an Android issue.
Any solution available?
Best,
smartn
Click to expand...
Click to collapse
This is really an Android problem. Also because the search only matches the begin of a word you can not search for "rgen" for example.
_keesj said:
Hi,
This is really an Android problem. Also because the search only matches the begin of a word you can not search for "rgen" for example.
Click to expand...
Click to collapse
1. No, as stated before, this is NOT an Android problem - it did not occur on other Android 4.2.2 mobiles that I've tried.
2. You're right, the search term has to match the beginning of a word. But this is the way it works, no matter what specific letters the search term contains, so it's not a bug but the way it's meant to be.
Hello
smartn said:
1. No, as stated before, this is NOT an Android problem - it did not occur on other Android 4.2.2 mobiles that I've tried.
2. You're right, the search term has to match the beginning of a word. But this is the way it works, no matter what specific letters the search term contains, so it's not a bug but the way it's meant to be.
Click to expand...
Click to collapse
I did not look at the code I tried entering a few name containing special chars and once I was able to reproduce the problem searched the web for an answer:
I found the following thread from 2009!
https://code.google.com/p/android/issues/detail?id=3732
Thanks for your effort, _keesje, but after flying over a good portion of the 235 entries on the website which you linked, it seems to me as if they were dealing with another bug in the search function: the problem that a contact search is only limited to the names, so you can't search by company etc.
Surely a problem worth mentioning, but not the least helpful in the matter I'm dealing with - or did I miss anything? If so, please provide the number of the entry.
smartn
In the meantime, Fairphone has replied to my direct request:
"Thank you for your email. Our development team is aware of this issue, and we hope to include a fix the future update.
Cheers,
Rick"
I hope so, too.
But meanwhile, I'm still thankful for any other approach...

Change default photo names to something more meaningful

Hello,
Does anyone know if there is a way to change the standard name format Google gives images: IMG_20160101_121728.jpg to something else like N5X_01Jan16_12.45.11.jpg? I found one app that seems to do this after the fact here: https://play.google.com/store/apps/details?id=ro.ciubex.dscautorename
I was just wondering if there was another native way in-camera phone to do it? Or is there another app some recommend?
Lastly, does anyone know what the last set of digits represent in the name? I know the first represent the date.
Thanks,
Derek
dereksurfs said:
Lastly, does anyone know what the last set of digits represent in the name? I know the first represent the date.
Click to expand...
Click to collapse
The time, in 24-hour format.
I doubt there's any way to change the name format. You could whip up a shell command to change them.
the standard camera app does not have an option for that.
also, as crachel pointed out, the second set of digits is the time of recording in 24h format.
this way the values are all ordered from largest to smallest (Y/M/D_H:M:S) and therefor will always be in chronological order.
as you see the file names include already everything you want (apart from the N5X part), just in numerical form, and in an order that is at least for machines easier to work with.
if you still want another format i'd be curious of what you would expect from that.
Interesting, when I looked at the last set of numbers, they did not match the timestamp of the file system. So I thought they were just random unique numbers. But if I look at EXIF data on Google Photos, the time looks correct. So, at least they provide more meaningful information than I initially thought. I would still prefer a more reader friendly format like the one I posted above for my own archival purposes. IMG is too generic as I have many cameras along with their associated images. I could care less what Google or anyone thinks is machine friendly. I program for a living and know user experience trumps whatever someone assumes is easiest on a computer. Plus, a computer can read any format since its simply a date pattern. I just prefer another pattern.
I've looked into the last 6 numbers too. In my findings it's the second when the photo/video was taken/started recording. Same for exif. The filesystem contains the second when it was finished written to "disk".
Also sometimes you get _1, _2, ... after that if more photo was recorded in the same second.

Categories

Resources