Thursday, 19 September 2013

Android Animated views

I have to admit, I am aesthetically challenged. Creating a nice GUI is not my game and I respected those who could design such things. Because of this limitation of mine, I generally look down on glittering UIs with contempt. But even I was moved - even if only a bit - by Android's animation capabilities.

Android is able to animate any View object and each and every View has a startAnimation() method that launches animation. Animations exist as independent objects that can be applied to the Views. Animation objects can even be populated from XML resources that live in the res/anim directory.

You can download the example program from here.

Let's look at the animation file below (again, XML mangling due to the limitations of the blog engine). This file can be found as res/anim/magnify.xml in the example program bundle.

[?xml version="1.0" encoding="utf-8"?]
[scale xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXScale="0.5"
android:toXScale="2.0"
android:fromYScale="0.5"
android:toYScale="2.0"
android:pivotX="0%"
android:pivotY="50%"
android:startOffset="0"
android:duration="400"
android:fillBefore="true" /]

This is a scaling animation. The attributes mean the followoing:
The content of the view is actually shrinken first (fromXScale, fromYScale=0.5) to half before it starts to grow to double its standard size and 4 times of the initial size (0.5->2.0). This is done both in X and Y axis.
The pivot point from which the object grows is 0% in the X axis. This means that the leftmost points of the object will stay in place and the object grows rightward to double size. Meanwhile, the pivot point on the Y axis is the middle of the object (50%), this means that the object will grow up and down from its center line.
The animation starts immediately (startOffset=0) and finishes in 400 msec.
Once we have an animation object, we can apply it to any view. In the example program, I created a simple list and applied the animation to the TextView list elements whenever one list element is selected (either by moving the selection with the arrow keys or clicking at list elements). Two points are worth noting:


Just because we animate, the list layout is not recalculated. Hence the generous top and bottom paddings around the list elements. There is enough space provided for the TextView to grow.
In the list row layout (res/layout/row.xml), the layout_width is set to fill_parent. This is seemingly random choice but actually, the program does not work well with wrap_content as layout_width. Whenever a list element is selected, its color changes to highlight. If the width is wrap_content, then the size of the TextView (hence the higlighted screen area) is just the length of the text. When the animation starts, the text grows past this size and the end of the text becomes unreadable. This is very important therefore to allow the list row to occupy the entire available width because then the entire row will be highlighted and the animation cannot grow larger than the highlighted area.
At last, two pictures about the beginning and the end of the animation.

How To Permanently Spoof Mac Address Of anddriod phone

-After your rooted head into terminal emulation type su and go into /data/misc/wifi

-Look for a file called nvram.txt

-Copy it to your sdcard and then to your cpu desktop open it with notepad and at the bottom of nvram.txt is the mac address

-This i was able to verify and test on android Citrus Ciena

-Edit that mac address and save it as nvram1.txt onto sdcard

-Now go back to data wifi misc and copy nvram.txt to nvram.bak

-Head into gui and then settings then wifi then turn on the wifi but don’t connect to any wifi

-turn off the wifi,switch back to terminal

-Copy the nvram1.txt to data misc wifi

-remove the original (make sure you got it backed up)

-Rename nvram1.txt to nvram.txt

-head back into gui and then settings then wifi

-Now for me it immediately stated unable to turn on wifi

-Ignore it and try to turn it on anyways

-When it turns on your newly edited mac address will take effect

-Connect to your AP

-NOW B4 REBOOTING YOU MUST CHANGE NVRAM BACK TO THE ORIGINAL!

How To Spoof MAC address Android Phone/Tab

Things You will need Before You spoof Mac Address


- A Rooted Phone

-BusyBox

-Terminal app



Type su

Disable network
Type ifconfig “interface” down

See Your current Mac Address (Also Note it down)
:busybox iplink show eth0
Change the MAC address of the interface
ifconfig “interface” hw ether 01:02:03:04:05:06

(replace it with mac address you want to spoof mac address of your phone )

Enable network
ifconfig “interface” up

Checking the MAC address
ifconfig “interface”

This Will Temporarily  spoof Your Mac address and willl change to original on next reboot.

Hack ANDROID Pattern Lock Instantly

This has been a common problem with most android users that, someone(while playing with their cellphone) activates the lock by drawing wrong unlocking patterns, leading finally to a window asking Google account
User name and password. I recently got screwed up, as the kid living next door tried unlocking my phone. If wrong pattern is entered 20 times, the Android OS locks your phone with a "TOO many pattern attempts" message and asks for your Google account name and password.

Now there are various reasons for which people can't come out of this situation -
Either they don't know the ID/Password.
The Packet Data is not activated, so even if right ID/Password is entered, it wont help.
The Internet setting of respective Network Service Provider is not installed.
It was a hard time for me to swallow the truth that, MY PHONE WAS LOCKED, as the account in the phone was of someone else's. I googled the solution for this, but found unusefull tricks unlocking the phone as they needed the phone to be in USB Debugging mode. But, somehow, i managed to find a solution to this(though it was done accidentally). If you go at any mobile shop they take ample amount for doing simple steps for unlocking it. I will tell you what they do. You need to follow some simple steps. I have tried the technique on Samsung Galaxy Y (Young). Probably it may work on all android devices

Note - this method involves wiping off all data on your phone, including installed apps and the setting you have done.
1.) Turn the phone off the phone
2.) Long press the upper volume key, menu key and the power key simultaneously
relieve for a fraction as soon as you see the screen display in "Samsung Galaxy Y young" again press the 3 keys simultaneously
3.) Now you will see a screen displaying "Android system Recovery"
4.)  select the 3rd option("Wipe data/factory reset") using the volume keys and press the centre menu key
5.) select the "Yes" option again using the same keys.
6.)after some time, it will say, the reset is done
7.)  just select the reboot option and your phone is UNLOCKED.

Android Secret Codes For Samsung, HTC, Motorola, Sony, LG And Other Devices



One of the most popular practices amongst software developers is to leave ‘backdoors’ within the code, which essentially allow anyone with knowledge to get into the system at a much deeper level than you’d expect from an end-user. These backdoors aren’t always with a malicious intent; most of the time, they allow the OEM or programmer to get into the system for troubleshooting when other, usual modes of access have been blocked. They can be quite friendly and helpful if you know what you’re doing.

Smartphones have a good share of these as well, where they’re generally known as secret codes. Most of the time, these numeric/symbolic sequences allow you to access hidden menus, diagnostic tests, areas that could change some of the most basic parameters of your device and whatnot. These secret codes, in fact, have not been exclusive to smartphones, but have long been a part of the dumb-phones and then the feature-phones before most major OEMs joined the smartphone bandwagon. For those devices that run Android, certain codes are shared across the board, and hence, can be used on a variety of devices.

Android Secret Codes

What follows is a collection of some of the secret codes common to the Android platform. All of these would be entered through the phone dialer (just punch in the sequence as shown). Since most hidden menus are manufacturer specific, there’s no guarantee that they’ll work across all Android smartphones, but you can try them out nevertheless on your Samsung, HTC, Motorola, Sony and other devices. Be advised, though, that some of these can cause serious changes to your device’s configuration, so don’t play with something that you don’t fully understand.

*#06# – IMEI number

*#0*# – Enter the service menu on newer phones like Galaxy S III

*#*#4636#*#* – Phone information, usage statistics and battery

*#*#34971539#*#* – Detailed camera information

*#*#273282*255*663282*#*#* – Immediate backup of all media files

*#*#197328640#*#* – Enable test mode for service

*#*#232339#*#* – Wireless LAN tests

*#*#0842#*#* – Backlight/vibration test

*#*#2664#*#* – Test the touchscreen

*#*#1111#*#* – FTA software version (1234 in the same code will give PDA and firmware version)

*#12580*369# – Software and hardware info

*#9090# – Diagnostic configuration

*#872564# – USB logging control

*#9900# – System dump mode

*#301279# – HSDPA/HSUPA Control Menu

*#7465625# – View phone lock status

*#*#7780#*#* – Reset the /data partition to factory state

*2767*3855# – Format device to factory state (will delete everything on phone)

##7764726 – Hidden service menu for Motorola Droid

Android Hacking Tips and Tricks

Android is the Linux based operating system designed primarily for touch screen mobile phones. Now a days android phones are so much popular that they covered almost 65% of total mobile phones market.They are rich in functionality as well as user friendly. Many android users don’t know much about the hidden features of android phones. Today we are sharing an article which will tell you the best secret android tricks and hidden features of android phones. Different versions of android versions support different set of android tricks, so try all the following android tricks. I am not sure which will going to work on your handset.



 1) Force reboot: 
Many times android users face a problem of freezing of mobile phone, In case your android phone is frozen, you can reboot it using an android trick.

Just press Power Button+ Home Key + Volume up button simultaneously.

2) Quick Google Access:
Android phones built primarily for internet, many of android users don’t know that android phones provide a way by which we can access Google search in just a single click. To use this android trick,

Press menu key and hold it for couple of seconds, it will launch the Google search.

3) Reboot Android in safe mode: 
As like computers, we can also reboot android phones in safe mode. The latest android jelly bean version provides an option to reboot in safe mode, if something goes wrong.
To reboot your android in safe mode, follow the below given instructions.


*Long press the power button
*Long press on the power off option.

Android phone will show a confirmation message about rebooting it in safe mode, if we reboot android phone in safe mode then all the 3rd party application will be disabled. These applications can again be enabled when we reboot our phone normally. This is a great android utility in case when, one of your 3rd party application is causing trouble for you and you want to hunt it.

4) Unlock android phones by face detection: 
This is a cool android trick by which you can unlock your phone by using face detection, In the jelly bean version, android provides a way by which android phone can be unlock using face detection, to make this feature more secure, jelly bean version added another layer of protection in which android phone can be unlocked only when the face is matched as well as we have to blink eyes in order to unlock phone. Blinking eyes tells the android security system that person is live and it’s not an illegal attempt of unlocking using a still image.
To activate this,

Go to Settings > Security > Screen lock > Face unlock.

5) Get detailed information about phone status:
We can get the detailed statistics like phone information, battery information, usage statistics and WiFi information by just dialing *#*#4636#*#*

This is a handy USSD to get the details about battery usage, DNS check, Ping, Application time usage time and so on.

6) Move android apps to SD card:
Its good idea to install android apps in SD card, but what if you installed apps on your phone memory. Don’t worry android phones provide a way by which we can move our apps to SD card. To move apps to SD card, follow these steps:

Go to settings > Application settings > Manage application > Select the application, You will see the option “Move to SD card”.

7) Hard Reset and Factory reset your android phone:
This android trick comes handy at the time of selling an android phone. Android phone can be formatted in two ways

Factory reset
Hard reset

a) Factory reset: In factory reset, your phone is being formatted to factory level. Means all the settings will go by default and all the internal data will be deleted. To factory reset a phone dial *#*#7780#*#*.

b) Hard reset: To hard reset a phone dial *2767*3855#, this will delete all the data (including internal and External SD data) as well as settings of android phone. Don’t try this code for testing purpose, until you are not sure. It will not ask for a confirmation.

8) Context menu in android:
long press on the screen, will show you additional options for customizing android phones. This context menu is somewhat similar to the right click menu of most operating systems.

9) Taking screen shots on android phone:
 Android phones offer a great feature by which we can take the screen shot without using any 3rd party application. However the screen shot android tricks vary from one android version to another version.

Press the Home button + power button (This trick work on most android phones.)
For Galaxy Nexus: Power button + volume down button.
For Galaxy Note 2 and S3: Swipe your palm on the screen to take screen shot.

10) Android Version Animation: 
This is another cool android trick to play with your android phone.
To use this android trick, Go to settings > about phone > Tab repeatedly on ‘Android version’.
After sometime, the android version will be animated.

smali syntax highlighting for sublime





have been using sublime text 2 + androguard plugin for decompiling and am liking it very much. it doesn't do as well producing correct java as, say, dex2jar + jdgui, but it's sometimes easier to read. it doesn't handle try/catch blocks at all -- just ignores them. this means it's a great alternative for jdgui, which will error out on methods with overlapping try/catch stuff.

since i've been using sublime, i've also needed a smali syntax highlighter, which i found here: https://github.com/ShaneWilton/sublime-smali

it's the best syntax highlighter i've seen because of the line level syntax validation it does. when you write smali, you can be more confident it is correct with this. you should check out the regex if you're a fan of such tedium.