Monday, May 6, 2013

Torchlight: "android:installLocation" manifest attribute

If we look at the Android application info on device with Android 2.2 and above there is button which will have label Move to SD card or Move to phone and in some cases this button is disabled with label Move to SD card.

This button is controlled by android:installLocation manifest attribute.

There are different values to this attribute:
  1. internalOnly (default value):
    If the value is such then the application must be installed on the internal device storage only and it will never be installed on the external storage. If the internal storage is full, then the system will not install the application. This is when button in application info is disabled with label Move to SD card.
  2. auto:
    If the value is such then the system will install the application on the internal storage by default. If the internal storage is full, then the system will install it on the external storage.
  3. preferExternal:
    If the value is such then the application prefers to be installed on the external storage. There is no guarantee this as application might be installed on internal storage if the external media is unavailable or full.
In both of the auto and preferExternal user can move the application to either internal or external storage through Move to SD card or Move to phone on application info screen.

In case of app installed on external storage  only .apk file is saved on the external storage, but all private user data, databases, optimized .dex files, and extracted native code are saved on the internal device memory.

Caution should be taken while declaring app to be installation on external storage as whenever external storage get unmounts or removed, the application get killed and becomes unavailable for user. If in the application, below services are to be used then value should be set to internalOnly:
  • Services
  • Alarm Services
  • Input Method Engines  
  • Live Wallpapers
  • App Widgets
  • Account Managers
  • Sync Adapters
  • Device Administrators
  • Broadcast Receivers listening for "boot completed"

Thursday, May 2, 2013

There are only Four Jobs in Whole world

Today, i stumbled upon an article by Lou Adler having title "There Are Only Four Jobs in the Whole World – Are You in the Right One?
Below is the copied content of the article which was to the point and superb:
-------
Everything starts with an idea. This is the first of the four jobs – the Thinkers. Builders convert these ideas into reality. This the second job. Improvers make this reality better. This is the third job. Producers do the work over and over again, delivering quality goods and services to the company’s customers in a repeatable manner. This is the fourth job. And then the process begins again with new ideas and new ways of doing business being developed as the old ones become stale.
As a company grows and reaches maturity, more of the work gets done by the Producers and Improvers. However, without a culture of consistent improvement, the Producers soon take over and implementing change becomes slower and slower until it stops. Long before this the Thinkers and Builders have left for some new venture. Improvers soon follow to join their former co-workers and hire new Producers to add some order to the newly created chaos. The old Producers who aren’t continually evolving, learning new skills and processes, are left behind to fend for themselves. Maintaining balance across all four work types is a constant, but a necessary, struggle for a company to continue to grow, adapt, and survive.
Every job has a mix of all four work types dependent on the actual work involved, the scope and scale of the role, and the company’s growth rate. To ensure balance and flexibility, all of these four work types should be taken into account when preparing any new performance-based job description. Here’s how:
Producers: these people execute or maintain a repeatable process. This can range from simple things like working on an inbound help desk and handling some transactional process, to more complex, like auditing the performance of a big system, writing code, or producing the monthly financial reports. Producers typically require training or advanced skills to be in a position to execute the process. To determine the appropriate Producer performance objectives, ask the hiring manager to define how any required skill is used on the job and how its success would be measured, e.g., “contact 15 new customers per week and have five agree to an onsite demonstration.“ This is a lot better than saying “the person must have 3-5 years of sales experience selling to sophisticated buyers of electro-mechanical control valves.”
Improvers: these people upgrade, change or make a repeatable process better. Managers are generally required to continually monitor and improve a process under their responsibility. Building, training and developing the team to implement a process is part of an Improver’s role. Improvers can be individual contributors or managers of teams and projects, the key is the focus on improving a existing system, business or process. A performance objective for an Improver could be “conduct a comprehensive process review of the wafer fab process to determine what it would take to improve end-to-end yield by 10%.”
Builders: these people take an idea from scratch and convert it into something tangible. This could be creating a new business, designing a complex new product, or developing a new process. Entrepreneurs, inventors, turn-around executives, those in R&D, and project managers are typical jobs that emphasize the Builder component. Ask the hiring manager what big changes, new developments, big problems or major projects the person in the new job would need to address to determine the Builder component. An example might be, “lead the implementation of the new SAP supply change system over every business unit including international.” This is a lot better than saying “must have five years international logistics background and strong expertise in SAP."
Thinkers: these people are the visionaries, strategists, intellects, and creators of the world, and every new idea starts with them. Their work covers new products, new business ideas, and different ways of doing everyday things. Ask hiring managers where the job requires thinking out-of-the-box or major problems to solve to develop the Thinker performance objectives. “Develop a totally new approach for reducing water usage by 50%,” is a lot better than saying “Must have 5-10 years of environmental engineering background including 3-5 years of wastewater management with a knack for creative solutions."
Recognize that every person is comprised of a mix of each work type, with one or two dominant. Likewise for every job. Most require strengths in one or two of the work types. As you select people for new roles, it's important to get this blending right. This starts by understanding the full requirements of the position, the strengths and weaknesses of others on the team, and the primary objective of the department, group or company. In the rush to hire, it’s easy to lose sight of this bigger picture, emphasizing skills and experience over performance and fit. This is how Builders get hired instead of Improvers and Thinkers get hired when Producers are required. While there are only four work types, hiring the wrong one is often how the wrong work gets done.
 ------
Since i loved the article and i am apologetic to the article owner that i copied it to my blog to preserve the words of wisdom with me, i think all categories spoken in the article are the only categories one should put himself into and one should visualize his own worth according to these categories.

Friday, February 8, 2013

Hacking Android - Part 2

If you have got your phone bricked where your Galaxy Y is getting stuck to the Samsung logo and phone is restarting again and again after displaying Samsung logo after few seconds and your recovery console is also not coming then i would say that you have HARD BRICKED your phone and now its the time you start reading the below steps to UN-BRICK it.

The technique i will be explaining for Unbricking the phone applies to Samsung phones and this method will flash Samsung stock ROM via tool named ODIN. Since ODIN is a windows os based tool, this method will only work in Windows OS.

Pre-requisite before you proceed with the below steps:
  1. Install Samsung Kies from Samsung website or from the cd obtained with your device.
  2. Install Samsung android drivers for your Windows OS
  3. In the device Go to Settings --> Applications --> Developer options and enable USB Debugging by clicking on the checkbox and turning it green
  4. Install ODIN by downloading from link
So, to un-brick your phone follow the below steps:
  1. Download the stock ROM from XDA Forum after checking the kernel version from
    Settings --> About phone --> Kernel version
  2. Extract the downloaded file into a folder on your Windows PC.
  3. If you are running Kies, Stop it and kill all its processes.
  4. If you are an Android developer or have Android SDK installed on your Windows PC, then stop all ADB (Android debug bridge) processes.
  5. Shutdown your device
  6. Now, by pressing Volume Down+Home Key, press Power key. This will boot the device in Download mode.
  7. When in download mode follow the instructions to continue and this will show the download screen (You can notice ODIN written on top left of phone screen in Galaxy Y).
  8. Connect your phone to the PC and start ODIN. 
  9. The ID:Com section in ODIN will turn yellow. If it doesn't then the device drivers are not installed properly.
  10. If you notice the yellow color in above step then click on PDA and browse to the folder created in Step 2 above.
  11. In the PDA section, select the file whose name has "PDA" in it. Click on Phone and select the file whose name has either PHONE or MODEM in it. Click on CSC and select the file whose name has CSC in it.
  12. Do leave PIT and BOOT empty
  13. Now, click on the Start button and this will start the flashing process of the Stock ROM.
  14. When the Flashing process is complete, you can notice PASS written in ODIN on a green background in your PC.
This will make your device just like new. If you are still stuck on the Samsung logo after following above steps then most probably you have selected the wrong ROM. So, download the correct ROM and run the steps mentioned again.

I hope this helps un-bricking your device.

Stay Good and Stay Lovely !! 

Hacking Android - Part 1


Its been a long time i wrote anything on my blog and now seems to be the time to put my guts out with the knowledge i have been gathering lately and i hope to revise it and others enjoy and use it.

To begin with i would like to say that this post is the result of my curiosity and research hobby which i have in my blood and if anything goes wrong because of anyone using it, then its not my fault. Though i will try that even a novice can do the steps i am gonna mention and stay away from trouble...but hey...we are humans and we are made to commit mistakes...so stay focused when trying to attempt such things and take responsibility for the mistakes (please don't take it personally as its just a weird thought which came in my mind which is always true).

So, here are the topics i am gonna discuss and hope this is good for the Part 1:

  • What is Root access in Android and why do we need it?
  • What are the steps to Root Android device ?
  • What is Bricking/Un-bricking of device ?
  • How to perform Backup of Android device to avoid Soft Bricking and overcoming Soft bricking by restoring the backup ?
  • Lets change the ROM to have what you love

Note that the steps mentioned in the below topics are for Samsung Galaxy Y and may differ for different devices but more or less will remain the same.

What is Root access in Android and why do we need it?

As Wikipedia puts it:

Android rooting is the process of allowing users of smartphones, tablets and other devices running the Android  mobile operating system to attain privileged control (known as "root access") within Android's subsystem.
As Android was derived from the Linux kernel, rooting an Android device is similar in practice to accessing administrative permissions on Linux or any other Unix-like operating system such as FreeBSD or OS X.

In a nutshell, by getting root access to an Android device you have access to the contents or files of Android operating system and you can affect its behavior and outlook the way you want and can even change the device's operating system to the customized version you want which are loosely called ROMs as android device use Flash memory instead of Read Only Memory (ROM) for storing operating system contents.

What are the steps to Root Android device ?

There are many steps to root android device some manually some using recovery/bootloader console but the best way i found is using update.zip which is described below:
  1. In the device Go to Settings --> Applications --> Developer options and enable USB Debugging by clicking on the checkbox and turning it green  
  2. Attach your device to your PC/Mac/Linux box (if you are using windows then do remember to install device drivers provided by your device manufacturer which is using Samsung Kies software in our case) and ensure that USB debugging icon is displayed in the device which tells that device is in debugging mode.
  3. Download update.zip 
  4. Copy the downloaded zip file to sdcard
  5. Disconnect your device and shut it down.
  6. Now, by pressing Volume Up key and Home key, press Power key. This will boot your device in a recovery mode
  7. When in recovery mode, press Volume Up and Volume Down keys to navigate in the menu and use Home key to select the option. Now select second option in the menu and navigate to the zip file copied in step 4 above. Select the zip file.
  8. After selecting the zip file it will take 10-15 seconds or more depending upon the condition of device hardware and the recovery menu will get displayed after the completion of process.
  9. Select first option to reboot the device as now the rooting process is complete. The zip file also contains Superuser.apk app to check if the device is rooted or not. So, move to the next step to check the same
  10. After your device boots normally go to the applications menu and check if Superuser application's presence. Open the application and it will ask for Superuser permission. Allow the permission and this proves that your device is rooted. Now you can install Titanium Backup from Android Store to perform backup and other root operations from which i am going to describe below.
What is Bricking/Un-bricking of device ?

As Wikipedia put it:

When used in reference to consumer electronics, a "brick" describes an electronic device such as a smart phone, game console, router, or tablet computer that owing to a serious misconfiguration, corrupted firmware or a hardware problem, can no longer function. The term derives from the vaguely cuboid shape of many electronic devices (and their detachable power supplies) and the suggestion that the device can only function as a large, heavy object.

In a nutshell, Bricking means that your device is of no use and you can use is as a paper weight and nothing can be done with it. On the contrary, Un-bricking refers to returning the device to its previous state (usable state).

There are two types of bricking Soft Bricking and Hard Bricking. If your device is Soft bricked then it means you have corrupted the system files of android os which is rendering the device useless. In Hard bricking the partitions of device gets corrupted rendering it useless. Soft bricking can be overcome by taking backup of device and then restoring it using a suitable tool. Hard bricking can be overcome by replacing the complete ROM of the device which then restores the partitions along with files.

I will cover details of how to overcome Hard bricking of the device in Part 2 so let us now concentrate on this Part 1 first.

How to perform Backup of Android device to avoid Soft Bricking and overcoming Soft bricking by restoring the backup?

This is not a sure shot way to prevent your device and can only prevent in case your recovery/bootloader device partition is not overwritten (Soft bricked). The method i will be explaining is using ClockWorkMod(CWM) and is based on recovery partition. Normally, people replaces their recovery partition with CWM but in the below steps we will not do that instead their is a file which runs CWM without replacing your recovery partition with it.

So, enough saying and here are the steps:
  1. Download ClockWorkMod zip file from link CWM.zip.
  2. Copy the downloaded zip file to sdcard
  3. Disconnect your device and shut it down.
  4. Now, by pressing Volume Up key and Home key, press Power key. This will boot your device in a recovery mode
  5. When in recovery mode, press Volume Up and Volume Down keys to navigate in the menu and use Home key to select the option. Now select second option in the menu and navigate to the zip file copied in step 4 above. Select the zip file.
  6. This will now show the CWM options and now select the appropriate option to backup your phone.
  7. Select the option for complete backup and this will backup your whole device to sdcard including partitions, data, etc. 
If you some how have corrupted the system files of your android device, you can select restore option and this will show you the option showing date on which backup was taken. Now you can select that option and device will return to its original state.

Lets change the ROM to have what you love

If you have followed the above steps to Backup/Restore your device then proceed ahead and do the greatest thing to your device - Giving it a new look and feel by installing new Android OS
  1. Backup your device
  2. Go to  The Unlocker - Galaxy Y ROMs site and download the ROM zip file 
  3. Copy the downloaded zip file to sdcard
  4. Disconnect your device and shut it down.
  5. Now, by pressing Volume Up key and Home key, press Power key. This will boot your device in a recovery mode
  6. When in recovery mode, press Volume Up and Volume Down keys to navigate in the menu and use Home key to select the option. Now select second option in the menu and navigate to the zip file copied in step 4 above. Select the zip file.
  7. After the selection, installation of ROM will start and when it completes reboot your device and when it starts you will have a device in your hand with everything new.
In case your device becomes slow go to the same site and get another ROM which better runs on your device. Some ROMs require CWM-Merruk which you can download from link  CWM-Merruk_Recovery_v1.0.8.5

If you have any queries or the links don't work for you then do let me know and i will update them.

So, this is all for this post, be happy, stay lovely and lets make this world a better place to live for each other :)

Thursday, July 5, 2012

Android can be hijacked

From the yesteryears i remember that Windows can be hijacked and is virus prone and now a days even Apple removed a line that "Mac is not virus prone" as was attacked by a trojan. The latest in the trend is Android Application Stack which is now proved to be hijacked....checkout this link:
Researchers create "clickjack rootkit" for Android that hijacks apps

Monday, July 2, 2012

Google I/O 2012

Google seems to be the one company which is driving world single handedly to the new horizon. This is how Google is driving the world


Google I/O 2012 Keynote Day 1: http://www.youtube.com/watch?v=VuC0i4xTyrI
Google I/O 2012 Keynote Day 2: http://www.youtube.com/watch?v=tPtJd6AzU8c


Wish i could have joined Google one day

Wednesday, June 27, 2012

How to route a mono sound from an android device to a handset/handfree

Today i was doing an RnD to route a mono sound from an android device to a handsfree/handset and after googling many things and trying out a few i was able to come up with a simple solution using BluetoothHandsfree profile.


Here is a code snippet:
<manifest>

<uses-permission android:name="
android.permission.MODIFY_AUDIO_SETTINGS" />
</manifest>

.................

BluetoothAdapter mBluetoothAdapter;
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
toast("Device does not support Bluetooth");
} else {
toast("Bluetooth is supported");
if (!mBluetoothAdapter.isEnabled()) {
toast("Requesting for Bluetooth");
Intent discoverableIntent = new Intent(
BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverableIntent.putExtra(
BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300);
startActivityForResult(discoverableIntent, REQUEST_ENABLE_BT);
} else {
toast("Bluetooth Enabled");
}
}

mBluetoothAdapter.getProfileProxy(getApplicationContext(),
mProfileListener, BluetoothProfile.HEADSET);

private BluetoothProfile.ServiceListener mProfileListener = new BluetoothProfile.ServiceListener() {
public void onServiceConnected(int profile, BluetoothProfile proxy) {
if (profile == BluetoothProfile.HEADSET) {
mBluetoothHeadset = (BluetoothHeadset) proxy;
Log.i(tag, "***** Headset proxy obtained *****");
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);

audioManager.setMode(AudioManager.MODE_IN_CALL);
audioManager.startBluetoothSco();
audioManager.setBluetoothScoOn(true);

short[] soundData = new short[8000 * 20];
for (int iii = 0; iii < 20 * 8000; iii++) {
soundData[iii] = 32767; // High Note
iii++;
soundData[iii] = 32767; // High Note
iii++;
soundData[iii] = -32768; // Low Note
iii++;
soundData[iii] = -32768; // Low Note
}

AudioTrack audioTrack = new AudioTrack(
AudioManager.STREAM_VOICE_CALL, 8000,
AudioFormat.CHANNEL_OUT_MONO,
AudioFormat.ENCODING_PCM_16BIT, soundData.length
* Short.SIZE, AudioTrack.MODE_STATIC);
audioTrack.write(soundData, 0, soundData.length);
audioTrack.play();
}
}

public void onServiceDisconnected(int profile) {
if (profile == BluetoothProfile.HEADSET) {
mBluetoothHeadset = null;
Log.i(tag, "***** Headset Disconnected *****");
}
}
};

After running this code in an activity a buzz sound can be listened in a headset/handsfree.




How to install node using Brew

This article talks about some simple steps to follow to install node using Brew . Though there are many other ways to do it but the method ...