Add automatic application package extraction from manifest

Automatic extraction of the application.package property has been added
leveradging xpath ant task. This reduces redundancy, removes hardcoded
application.package and solves bug with uninstalling test application
package. In order to function properly needs removing application.package
from build.properties file.
diff --git a/tools/scripts/android_rules.xml b/tools/scripts/android_rules.xml
index e91dc0b..4d74ae2 100644
--- a/tools/scripts/android_rules.xml
+++ b/tools/scripts/android_rules.xml
@@ -22,9 +22,16 @@
         classname="com.android.ant.ApkBuilderTask"
         classpathref="android.antlibs" />
 
+    <taskdef name="xpath"
+        classname="com.android.ant.XPathTask"
+        classpathref="android.antlibs" />
+
     <!-- Properties -->
 
     <property name="android.tools.dir" location="${sdk.dir}/tools" />
+    <!-- Name of the application package extracted from manifest file -->
+    <xpath input="AndroidManifest.xml" expression="/manifest/@package"
+                output="application.package" />
 
     <!-- Input directories -->
     <property name="source.dir" value="src" />
diff --git a/tools/scripts/android_test_rules.xml b/tools/scripts/android_test_rules.xml
index 14bdb2f..60518df 100644
--- a/tools/scripts/android_test_rules.xml
+++ b/tools/scripts/android_test_rules.xml
@@ -8,11 +8,14 @@
     <property name="instrumentation.absolute.dir" location="${instrumentation.dir}" />
 
     <property name="test.runner" value="android.test.InstrumentationTestRunner" />
-    <property name="application.package.to.instrument" value="${application.package}.tests" />
+    <!-- Application package of the tested project extracted from its manifest file -->
+    <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
+                expression="/manifest/@package" output="tested.application.package" />
 
     <!-- TODO: make it more configurable in the next CL's - now it is default for auto-generated
          project -->
-    <property name="emma.dump.file" value="/data/data/${application.package}/files/coverage.ec" />
+    <property name="emma.dump.file"
+                  value="/data/data/${tested.application.package}/files/coverage.ec" />
 
     <macrodef name="run-tests-helper">
         <attribute name="emma.enabled" default="false" />
@@ -28,7 +31,7 @@
                    <arg value="coverage" />
                    <arg value="@{emma.enabled}" />
                 <extra-instrument-args />
-                <arg value="${application.package.to.instrument}/${test.runner}" />
+                <arg value="${application.package}/${test.runner}" />
             </exec>
         </sequential>
     </macrodef>