Reversing Snapchat – Pressure Cooker Hidden Code?

So I was screwing around with Android app hacking and I figured the Snapchat App for Android would be a cool read. While I was originally more interested in reversing the app and making a script to automate Snapchat it turns out someone has already done it: https://github.com/dstelljes/php-snapchat

Dang it!

The process was no a complete waste however, as I stumbled upon something very weird…

Note: To get this source for yourself you’ll need to get the Snapchat APK. Then use dex2jar to create a .jar file, now you can use a Java Decompiler to view the source (in Java). This is possible because Java compiles into bytecode (an intermediary language) and not into machine code.

If you check under the “ui” package:

Selection_024

You’ll notice this:

Selection_023

 

Here is the weird code I’ve found:

To make things even more weird it’s not reference or used anywhere!

Seriously. It’s just a random class that’s never actually used anywhere:

Not sure what to think about this, I’ve put it here to see if anyone else reverses the Snapchat app and Googles this code ;). If you are reversing the code and have more info please let me know in the comments or personally as I’m interested as to why this is here at all.

Until next time,
-mandatory

6 comments

  1. In Snapchat you can draw on snaps (images) before you send them… If you’re in the Snapchat beta there’s this cool feature where it “detects” the pressure of you finger whilst drawing to give you different thickness’s of drawn lines.
    The pressure cooker code is simply detection for how much surface area your finger covers on the screen to give you an appropriate thickness of drawn line output.
    “calEditor.putFloat(“HISTORICAL_LOW_PRESSURE”, this.mPressureProcessor.mLowestInput);”
    I guess this hasn’t been added fully to the normal APK, but its working in the beta :)

    1. This is the first real answer I’ve gotten to this. Though it doesn’t really explain the temperature does it? I mean your phone can’t detect that :) but this is the most plausible idea I’ve heard so far.

  2. Where is the temperature that you are referring to? I must be blind because I can’t find it.

    Anyway, the explanation for the filtering is that android, for the pressure of how hard you are pressing down ranges from 0 to 1. If the android is calibrated incorrectly or just has fucked up sensors, it can return values >1.

    Values > 1 are still useful though when you just convert it to relative and you can’t really discard samples else the line thickness will random shrink to nothing (I think, it’s late but all I can say it will look weird when the app is expecting a value between 0 and 1 and gets 3)

    Stackoverflow explaining pressure: http://stackoverflow.com/questions/3913808/metric-of-motionevent-api-getpressure-getsize

    1. You’re absolutely right. I need to sleep more – my brain read all the 40.0F as temperatures because I had the premonition of it being a “pressure cooker”. Obviously they’re floats ;) I think we can mark this solved, appreciate all the input from everyone!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">